diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2019-09-04 16:04:19 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2019-09-04 20:13:11 +0200 |
commit | 83441d01cc26d0fc2480d5a5c71d7b7fa2764d71 (patch) | |
tree | 24c52637245bada299a1bcc1826a09c3fbc97e5e | |
parent | d6b5bebb75c0aa4062d5ea6c15f6ac998e27a9a7 (diff) |
#915 adds test for too large HTTP request
This test checks for too large HTTP requests, for example:
POST /clients
with a body of 4096 bytes.
-rw-r--r-- | admin/Sources/Services/ogAdmServer/tests/units/test_0014_big_request.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/admin/Sources/Services/ogAdmServer/tests/units/test_0014_big_request.py b/admin/Sources/Services/ogAdmServer/tests/units/test_0014_big_request.py new file mode 100644 index 00000000..5e5e2d71 --- /dev/null +++ b/admin/Sources/Services/ogAdmServer/tests/units/test_0014_big_request.py @@ -0,0 +1,19 @@ +import requests +import unittest + +MAX_REQ_SIZE = 4096 + +class TestBigRequest(unittest.TestCase): + + def setUp(self): + self.url = 'http://localhost:8888/clients' + self.data = 'X' * MAX_REQ_SIZE + + def test_post(self): + with self.assertRaises(requests.exceptions.ConnectionError) as context: + requests.post(self.url, data=self.data) + + self.assertTrue('Connection reset by peer' in str(context.exception)) + +if __name__ == '__main__': + unittest.main() |