test_python_application.py (1043:357a658d1210) test_python_application.py (1064:75a64629661f)
1import time
2import unittest
3from unit.applications.lang.python import TestApplicationPython
4
5
6class TestPythonApplication(TestApplicationPython):
7 prerequisites = ['python']
8

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

86
87 resp = self.get()
88
89 self.assertEqual(resp['status'], 200, 'query string absent status')
90 self.assertEqual(
91 resp['headers']['Query-String'], '', 'query string absent'
92 )
93
1import time
2import unittest
3from unit.applications.lang.python import TestApplicationPython
4
5
6class TestPythonApplication(TestApplicationPython):
7 prerequisites = ['python']
8

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

86
87 resp = self.get()
88
89 self.assertEqual(resp['status'], 200, 'query string absent status')
90 self.assertEqual(
91 resp['headers']['Query-String'], '', 'query string absent'
92 )
93
94 @unittest.expectedFailure
94 @unittest.skip('not yet')
95 def test_python_application_server_port(self):
96 self.load('server_port')
97
98 self.assertEqual(
99 self.get()['headers']['Server-Port'], '7080', 'Server-Port header'
100 )
101
102 def test_python_application_204_transfer_encoding(self):

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

322 self.conf({"listeners": {}, "applications": {}})
323
324 self.stop()
325
326 self.assertIsNotNone(
327 self.wait_for_record(r'At exit called\.'), 'atexit'
328 )
329
95 def test_python_application_server_port(self):
96 self.load('server_port')
97
98 self.assertEqual(
99 self.get()['headers']['Server-Port'], '7080', 'Server-Port header'
100 )
101
102 def test_python_application_204_transfer_encoding(self):

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

322 self.conf({"listeners": {}, "applications": {}})
323
324 self.stop()
325
326 self.assertIsNotNone(
327 self.wait_for_record(r'At exit called\.'), 'atexit'
328 )
329
330 @unittest.expectedFailure
330 @unittest.skip('not yet')
331 def test_python_application_start_response_exit(self):
332 self.load('start_response_exit')
333
334 self.assertEqual(self.get()['status'], 500, 'start response exit')
335
331 def test_python_application_start_response_exit(self):
332 self.load('start_response_exit')
333
334 self.assertEqual(self.get()['status'], 500, 'start response exit')
335
336 @unittest.expectedFailure
336 @unittest.skip('not yet')
337 def test_python_application_input_iter(self):
338 self.load('input_iter')
339
340 body = '0123456789'
341
342 self.assertEqual(self.post(body=body)['body'], body, 'input iter')
343
344 def test_python_application_input_read_length(self):

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

385 'Input-Length': '-1',
386 'Connection': 'close',
387 },
388 body=body,
389 )
390
391 self.assertEqual(resp['body'], body, 'input read length negative')
392
337 def test_python_application_input_iter(self):
338 self.load('input_iter')
339
340 body = '0123456789'
341
342 self.assertEqual(self.post(body=body)['body'], body, 'input iter')
343
344 def test_python_application_input_read_length(self):

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

385 'Input-Length': '-1',
386 'Connection': 'close',
387 },
388 body=body,
389 )
390
391 self.assertEqual(resp['body'], body, 'input read length negative')
392
393 @unittest.expectedFailure
393 @unittest.skip('not yet')
394 def test_python_application_errors_write(self):
395 self.load('errors_write')
396
397 self.get()
398
399 self.stop()
400
401 self.assertIsNotNone(

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

413
414 self.assertEqual(self.get()['body'], '0123456789', 'body io')
415
416 def test_python_application_body_io_file(self):
417 self.load('body_io_file')
418
419 self.assertEqual(self.get()['body'], 'body\n', 'body io file')
420
394 def test_python_application_errors_write(self):
395 self.load('errors_write')
396
397 self.get()
398
399 self.stop()
400
401 self.assertIsNotNone(

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

413
414 self.assertEqual(self.get()['body'], '0123456789', 'body io')
415
416 def test_python_application_body_io_file(self):
417 self.load('body_io_file')
418
419 self.assertEqual(self.get()['body'], 'body\n', 'body io file')
420
421 @unittest.expectedFailure
421 @unittest.skip('not yet')
422 def test_python_application_syntax_error(self):
423 self.skip_alerts.append(r'Python failed to import module "wsgi"')
424 self.load('syntax_error')
425
426 self.assertEqual(self.get()['status'], 500, 'syntax error')
427
428 def test_python_application_close(self):
429 self.load('close')

--- 40 unchanged lines hidden ---
422 def test_python_application_syntax_error(self):
423 self.skip_alerts.append(r'Python failed to import module "wsgi"')
424 self.load('syntax_error')
425
426 self.assertEqual(self.get()['status'], 500, 'syntax error')
427
428 def test_python_application_close(self):
429 self.load('close')

--- 40 unchanged lines hidden ---