From f57e729a119660182d333f513b70b78177eb2b62 Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Tue, 25 Dec 2018 16:35:35 +0300 Subject: Tests: expectedFailure's removed from test_node_application.py. Also removed alert skip in test_node_application_write_before_writeHead. Fixes committed in 1340e3539362, 1e008ef94f43, 5df32621af19, dae402cb243f and 41f561b3a178. --- test/test_node_application.py | 7 ------- 1 file changed, 7 deletions(-) (limited to 'test/test_node_application.py') diff --git a/test/test_node_application.py b/test/test_node_application.py index 5dedb5a3..a9f5b8a3 100644 --- a/test/test_node_application.py +++ b/test/test_node_application.py @@ -112,7 +112,6 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.assertEqual(self.get()['body'], '6\r\nbuffer\r\n0\r\n\r\n', 'write buffer') - @unittest.expectedFailure def test_node_application_write_callback(self): self.load('write_callback') @@ -122,7 +121,6 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): 'write callback') def test_node_application_write_before_writeHead(self): - self.skip_alerts.append(r'process \d+ exited on signal') self.load('write_before_write_head') self.get() @@ -182,7 +180,6 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.assertEqual(self.get()['headers']['X-Type'], 'number', 'get header type') - @unittest.expectedFailure def test_node_application_header_name_case(self): self.load('header_name_case') @@ -202,9 +199,7 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.assertTrue(self.waitforfiles(self.testdir + '/node/callback'), 'promise handler') - @unittest.expectedFailure def test_node_application_promise_handler_write_after_end(self): - self.skip_alerts.append(r'process \d+ exited on signal') self.load('promise_handler') self.assertEqual(self.post(headers={ @@ -249,13 +244,11 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.assertNotIn('status', self.get(), 'header name valid') - @unittest.expectedFailure def test_node_application_header_value_object(self): self.load('header_value_object') self.assertIn('X-Header', self.get()['headers'], 'header value object') - @unittest.expectedFailure def test_node_application_get_header_names(self): self.load('get_header_names') -- cgit From d625691ff45bd6f352a504694629af2407a7d1a1 Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Tue, 25 Dec 2018 16:35:35 +0300 Subject: Tests: test_node_application_write_before_writeHead reworked. Added res.end() call in application and response status check. Also, renamed to test_node_application_write_before_write_head. --- test/test_node_application.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test/test_node_application.py') diff --git a/test/test_node_application.py b/test/test_node_application.py index a9f5b8a3..05b518f5 100644 --- a/test/test_node_application.py +++ b/test/test_node_application.py @@ -120,10 +120,10 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.assertTrue(self.waitforfiles(self.testdir + '/node/callback'), 'write callback') - def test_node_application_write_before_writeHead(self): + def test_node_application_write_before_write_head(self): self.load('write_before_write_head') - self.get() + self.assertEqual(self.get()['status'], 200, 'write before writeHead') def test_node_application_double_end(self): self.load('double_end') -- cgit From 4de2c8b56719fce6b95b6f8a613b349590a3676f Mon Sep 17 00:00:00 2001 From: Andrey Zelenkov Date: Wed, 27 Feb 2019 19:15:02 +0300 Subject: Tests: added "Host" and "Connetion" headers where necessary. Also minor header organizing. --- test/test_node_application.py | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'test/test_node_application.py') diff --git a/test/test_node_application.py b/test/test_node_application.py index 05b518f5..cd64fefa 100644 --- a/test/test_node_application.py +++ b/test/test_node_application.py @@ -28,7 +28,8 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): resp = self.post(headers={ 'Host': 'localhost', 'Content-Type': 'text/html', - 'Custom-Header': 'blah' + 'Custom-Header': 'blah', + 'Connection': 'close' }, body=body) self.assertEqual(resp['status'], 200, 'status') @@ -43,10 +44,11 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): raw_headers = headers.pop('Request-Raw-Headers') self.assertRegex(raw_headers, r'^(?:Host|localhost|Content-Type|' \ - 'text\/html|Custom-Header|blah|Content-Length|17|,)+$', - 'raw headers') + 'text\/html|Custom-Header|blah|Content-Length|17|Connection|' \ + 'close|,)+$', 'raw headers') self.assertDictEqual(headers, { + 'Connection': 'close', 'Content-Length': str(len(body)), 'Content-Type': 'text/html', 'Request-Method': 'POST', @@ -91,17 +93,17 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.load('mirror') (resp, sock) = self.post(headers={ + 'Host': 'localhost', 'Connection': 'keep-alive', - 'Content-Type': 'text/html', - 'Host': 'localhost' + 'Content-Type': 'text/html' }, start=True, body='0123456789' * 500) self.assertEqual(resp['body'], '0123456789' * 500, 'keep-alive 1') resp = self.post(headers={ + 'Host': 'localhost', 'Connection': 'close', - 'Content-Type': 'text/html', - 'Host': 'localhost' + 'Content-Type': 'text/html' }, sock=sock, body='0123456789') self.assertEqual(resp['body'], '0123456789', 'keep-alive 2') @@ -142,7 +144,8 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): resp = self.get(headers={ 'Host': 'localhost', - 'X-Remove': 'X-Header' + 'X-Remove': 'X-Header', + 'Connection': 'close' }) self.assertEqual(resp['headers']['Was-Header'], 'true', 'was header') self.assertEqual(resp['headers']['Has-Header'], 'false', 'has header') @@ -153,7 +156,8 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.assertEqual(self.get(headers={ 'Host': 'localhost', - 'X-Remove': 'blah' + 'X-Remove': 'blah', + 'Connection': 'close' })['headers']['Has-Header'], 'true', 'remove header nonexisting') def test_node_application_update_header(self): @@ -194,7 +198,8 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.assertEqual(self.post(headers={ 'Host': 'localhost', - 'Content-Type': 'text/html' + 'Content-Type': 'text/html', + 'Connection': 'close' }, body='callback')['status'], 200, 'promise handler request') self.assertTrue(self.waitforfiles(self.testdir + '/node/callback'), 'promise handler') @@ -205,7 +210,8 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.assertEqual(self.post(headers={ 'Host': 'localhost', 'Content-Type': 'text/html', - 'X-Write-Call': '1' + 'X-Write-Call': '1', + 'Connection': 'close' }, body='callback')['status'], 200, 'promise handler request write after end') @@ -214,7 +220,8 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.assertEqual(self.post(headers={ 'Host': 'localhost', - 'Content-Type': 'text/html' + 'Content-Type': 'text/html', + 'Connection': 'close' }, body='end')['status'], 200, 'promise end request') self.assertTrue(self.waitforfiles(self.testdir + '/node/callback'), 'promise end') @@ -224,7 +231,8 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.post(headers={ 'Host': 'localhost', - 'Content-Type': 'text/html' + 'Content-Type': 'text/html', + 'Connection': 'close' }, body='callback1') self.assertTrue(self.waitforfiles(self.testdir + '/node/callback1'), @@ -232,7 +240,8 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.post(headers={ 'Host': 'localhost', - 'Content-Type': 'text/html' + 'Content-Type': 'text/html', + 'Connection': 'close' }, body='callback2') self.assertTrue(self.waitforfiles(self.testdir + '/node/callback2'), @@ -260,12 +269,14 @@ class TestUnitNodeApplication(unit.TestUnitApplicationNode): self.assertEqual(self.get(headers={ 'Host': 'localhost', - 'X-Header': 'length' + 'X-Header': 'length', + 'Connection': 'close' })['headers']['X-Has-Header'], 'false', 'has header length') self.assertEqual(self.get(headers={ 'Host': 'localhost', - 'X-Header': 'Date' + 'X-Header': 'Date', + 'Connection': 'close' })['headers']['X-Has-Header'], 'false', 'has header date') def test_node_application_write_multiple(self): -- cgit