Last change
on this file was
cb9edc8,
checked in by OpenGnSys Support Team <soporte-og@…>, 4 years ago
|
ogClient is AGPLv3+
Update license header in files.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | # |
---|
2 | # Copyright (C) 2020-2021 Soleta Networks <info@soleta.eu> |
---|
3 | # |
---|
4 | # This program is free software: you can redistribute it and/or modify it under |
---|
5 | # the terms of the GNU Affero General Public License as published by the |
---|
6 | # Free Software Foundation; either version 3 of the License, or |
---|
7 | # (at your option) any later version. |
---|
8 | |
---|
9 | from server import Server |
---|
10 | from client import Client |
---|
11 | import unittest |
---|
12 | |
---|
13 | class TestOtherRequests(unittest.TestCase): |
---|
14 | |
---|
15 | def test_non_existent_function(self): |
---|
16 | post_req = 'POST /this_function_does_not_exist HTTP/1.0\r\n' + \ |
---|
17 | 'Content-Length: 0\r\nContent-Type: application/json\r\n\r\n' |
---|
18 | get_req = 'GET /this_function_does_not_exist HTTP/1.0\r\n' + \ |
---|
19 | 'Content-Length: 0\r\nContent-Type: application/json\r\n\r\n' |
---|
20 | c = Client() |
---|
21 | s = Server() |
---|
22 | s.connect() |
---|
23 | s.send(post_req) |
---|
24 | post_response = s.recv() |
---|
25 | s.send(get_req) |
---|
26 | get_response = s.recv() |
---|
27 | s.stop() |
---|
28 | c.stop() |
---|
29 | self.assertRegex(post_response, '^HTTP/1.0 400 Bad Request\r\n*') |
---|
30 | self.assertRegex(get_response, '^HTTP/1.0 400 Bad Request\r\n*') |
---|
31 | |
---|
32 | if __name__ == '__main__': |
---|
33 | unittest.main() |
---|
Note: See
TracBrowser
for help on using the repository browser.