diff options
author | Andrey Zelenkov <zelenkov@nginx.com> | 2019-05-30 16:47:39 +0300 |
---|---|---|
committer | Andrey Zelenkov <zelenkov@nginx.com> | 2019-05-30 16:47:39 +0300 |
commit | 67772cd3e9905820ef090b0ae52b571f542548f5 (patch) | |
tree | 6fe5d5caf1caf05ebe4621c203b2ba181ba25a21 /test | |
parent | 90c5d3f5c0ad42ccdb764684f721b511131e0782 (diff) | |
download | unit-67772cd3e9905820ef090b0ae52b571f542548f5.tar.gz unit-67772cd3e9905820ef090b0ae52b571f542548f5.tar.bz2 |
Tests: fixed tests without "Host" header.
Diffstat (limited to '')
-rw-r--r-- | test/test_http_header.py | 7 | ||||
-rw-r--r-- | test/test_java_application.py | 11 | ||||
-rw-r--r-- | test/test_routing.py | 29 |
3 files changed, 26 insertions, 21 deletions
diff --git a/test/test_http_header.py b/test/test_http_header.py index f4449ea0..603f6f0f 100644 --- a/test/test_http_header.py +++ b/test/test_http_header.py @@ -1,3 +1,4 @@ +import unittest from unit.applications.lang.python import TestApplicationPython @@ -296,15 +297,13 @@ Connection: close 'Content-Length multiple fields', ) + @unittest.skip('not yet') def test_http_header_host_absent(self): self.load('host') resp = self.get(headers={'Connection': 'close'}) - self.assertEqual(resp['status'], 200, 'Host absent status') - self.assertNotEqual( - resp['headers']['X-Server-Name'], '', 'Host absent SERVER_NAME' - ) + self.assertEqual(resp['status'], 400, 'Host absent status') def test_http_header_host_empty(self): self.load('host') diff --git a/test/test_java_application.py b/test/test_java_application.py index 7ccaadd5..5d0350fa 100644 --- a/test/test_java_application.py +++ b/test/test_java_application.py @@ -1128,17 +1128,6 @@ class TestJavaApplication(TestApplicationJava): 'get header names not equal', ) - def test_java_application_get_header_names_empty(self): - self.load('get_header_names') - - self.assertEqual(self.get()['status'], 200, 'init') - - self.assertNotIn( - 'X-Reply-0', - self.get(headers={}, read_timeout=1)['headers'], - 'get header names empty', - ) - def test_java_application_header_int(self): self.load('header_int') diff --git a/test/test_routing.py b/test/test_routing.py index f93ccd68..26d712a8 100644 --- a/test/test_routing.py +++ b/test/test_routing.py @@ -694,12 +694,6 @@ class TestRouting(TestApplicationProto): ) self.assertEqual( - self.get(headers={'Connection': 'close'})['status'], - 404, - 'match host positive empty', - ) - - self.assertEqual( self.get(headers={'Host': 'localhost.', 'Connection': 'close'})[ 'status' ], @@ -731,6 +725,28 @@ class TestRouting(TestApplicationProto): 'match host positive example.com', ) + @unittest.skip('not yet') + def test_routes_match_host_absent(self): + self.assertIn( + 'success', + self.conf( + [ + { + "match": {"host": "localhost"}, + "action": {"pass": "applications/empty"}, + } + ], + 'routes', + ), + 'match host absent configure', + ) + + self.assertEqual( + self.get(headers={'Connection': 'close'})['status'], + 400, + 'match host absent', + ) + def test_routes_match_host_ipv4(self): self.assertIn( 'success', @@ -969,6 +985,7 @@ class TestRouting(TestApplicationProto): 200, 'match host empty 2', ) + self.assertEqual(self.get()['status'], 404, 'match host empty 3') def test_routes_match_uri_positive(self): self.assertIn( |