test_settings.py (1654:fc7d0578e124) test_settings.py (1702:7acd651dfaf2)
1import re
2import socket
3import time
4
5import pytest
6
7from unit.applications.lang.python import TestApplicationPython
8

--- 246 unchanged lines hidden (view full) ---

255 assert resp['status'] == 200, 'status size 32'
256 assert resp['body'] == body, 'status body 32'
257
258 @pytest.mark.skip('not yet')
259 def test_settings_negative_value(self):
260 assert 'error' in self.conf(
261 {'http': {'max_body_size': -1}}, 'settings'
262 ), 'settings negative value'
1import re
2import socket
3import time
4
5import pytest
6
7from unit.applications.lang.python import TestApplicationPython
8

--- 246 unchanged lines hidden (view full) ---

255 assert resp['status'] == 200, 'status size 32'
256 assert resp['body'] == body, 'status body 32'
257
258 @pytest.mark.skip('not yet')
259 def test_settings_negative_value(self):
260 assert 'error' in self.conf(
261 {'http': {'max_body_size': -1}}, 'settings'
262 ), 'settings negative value'
263
264 def test_settings_body_buffer_size(self):
265 self.load('mirror')
266
267 assert 'success' in self.conf(
268 {
269 'http': {
270 'max_body_size': 64 * 1024 * 1024,
271 'body_buffer_size': 32 * 1024 * 1024,
272 }
273 },
274 'settings',
275 )
276
277 body = '0123456789abcdef'
278 resp = self.post(body=body)
279 assert bool(resp), 'response from application'
280 assert resp['status'] == 200, 'status'
281 assert resp['body'] == body, 'body'
282
283 body = '0123456789abcdef' * 1024 * 1024
284 resp = self.post(body=body, read_buffer_size=1024 * 1024)
285 assert bool(resp), 'response from application 2'
286 assert resp['status'] == 200, 'status 2'
287 assert resp['body'] == body, 'body 2'
288
289 body = '0123456789abcdef' * 2 * 1024 * 1024
290 resp = self.post(body=body, read_buffer_size=1024 * 1024)
291 assert bool(resp), 'response from application 3'
292 assert resp['status'] == 200, 'status 3'
293 assert resp['body'] == body, 'body 3'
294
295 body = '0123456789abcdef' * 3 * 1024 * 1024
296 resp = self.post(body=body, read_buffer_size=1024 * 1024)
297 assert bool(resp), 'response from application 4'
298 assert resp['status'] == 200, 'status 4'
299 assert resp['body'] == body, 'body 4'
300