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
|
Rev | Line | |
---|
[a5ce597] | 1 | # |
---|
[cb9edc8] | 2 | # Copyright (C) 2020-2021 Soleta Networks <info@soleta.eu> |
---|
[a5ce597] | 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 |
---|
[cb9edc8] | 6 | # Free Software Foundation; either version 3 of the License, or |
---|
| 7 | # (at your option) any later version. |
---|
[a5ce597] | 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' + \ |
---|
[f86999d] | 17 | 'Content-Length: 0\r\nContent-Type: application/json\r\n\r\n' |
---|
[a5ce597] | 18 | get_req = 'GET /this_function_does_not_exist HTTP/1.0\r\n' + \ |
---|
[f86999d] | 19 | 'Content-Length: 0\r\nContent-Type: application/json\r\n\r\n' |
---|
[a5ce597] | 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.