test_python_application.py (1304:5b67d67b4997) test_python_application.py (1400:cbd75efbfb74)
1import re
2import os
3import grp
4import pwd
5import time
6import unittest
7from unit.applications.lang.python import TestApplicationPython
8

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

379 )
380
381 @unittest.skip('not yet')
382 def test_python_application_start_response_exit(self):
383 self.load('start_response_exit')
384
385 self.assertEqual(self.get()['status'], 500, 'start response exit')
386
1import re
2import os
3import grp
4import pwd
5import time
6import unittest
7from unit.applications.lang.python import TestApplicationPython
8

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

379 )
380
381 @unittest.skip('not yet')
382 def test_python_application_start_response_exit(self):
383 self.load('start_response_exit')
384
385 self.assertEqual(self.get()['status'], 500, 'start response exit')
386
387 @unittest.skip('not yet')
388 def test_python_application_input_iter(self):
389 self.load('input_iter')
390
387 def test_python_application_input_iter(self):
388 self.load('input_iter')
389
391 body = '0123456789'
390 body = '''0123456789
391next line
392
392
393 self.assertEqual(self.post(body=body)['body'], body, 'input iter')
393last line'''
394
394
395 resp = self.post(body=body)
396 self.assertEqual(resp['body'], body, 'input iter')
397 self.assertEqual(
398 resp['headers']['X-Lines-Count'], '4', 'input iter lines'
399 )
400
401 def test_python_application_input_readline(self):
402 self.load('input_readline')
403
404 body = '''0123456789
405next line
406
407last line'''
408
409 resp = self.post(body=body)
410 self.assertEqual(resp['body'], body, 'input readline')
411 self.assertEqual(
412 resp['headers']['X-Lines-Count'], '4', 'input readline lines'
413 )
414
415 def test_python_application_input_readline_size(self):
416 self.load('input_readline_size')
417
418 body = '''0123456789
419next line
420
421last line'''
422
423 self.assertEqual(
424 self.post(body=body)['body'], body, 'input readline size'
425 )
426 self.assertEqual(
427 self.post(body='0123')['body'], '0123', 'input readline size less'
428 )
429
430 def test_python_application_input_readlines(self):
431 self.load('input_readlines')
432
433 body = '''0123456789
434next line
435
436last line'''
437
438 resp = self.post(body=body)
439 self.assertEqual(resp['body'], body, 'input readlines')
440 self.assertEqual(
441 resp['headers']['X-Lines-Count'], '4', 'input readlines lines'
442 )
443
444 def test_python_application_input_readlines_huge(self):
445 self.load('input_readlines')
446
447 body = (
448 '''0123456789 abcdefghi
449next line: 0123456789 abcdefghi
450
451last line: 987654321
452'''
453 * 512
454 )
455
456 self.assertEqual(
457 self.post(body=body, read_buffer_size=16384)['body'],
458 body,
459 'input readlines huge',
460 )
461
395 def test_python_application_input_read_length(self):
396 self.load('input_read_length')
397
398 body = '0123456789'
399
400 resp = self.post(
401 headers={
402 'Host': 'localhost',

--- 355 unchanged lines hidden ---
462 def test_python_application_input_read_length(self):
463 self.load('input_read_length')
464
465 body = '0123456789'
466
467 resp = self.post(
468 headers={
469 'Host': 'localhost',

--- 355 unchanged lines hidden ---