mirror of https://git.48k.eu/ogserver
#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.master
parent
3e8fcf0b40
commit
784495f5d5
|
@ -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()
|
Loading…
Reference in New Issue