summaryrefslogtreecommitdiffstats
path: root/tests/units/test_0014_big_request.py
blob: 5e5e2d71b531e94041c8c72eb0cc74da3a2174f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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()