diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2022-01-31 23:10:30 +0000 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2022-01-31 23:10:30 +0000 |
commit | e53ce40c5854d95722cdfc198626fcd5aecbe563 (patch) | |
tree | fe3be3f5d9685c29424e84f0f08b9459ea5de37b /test/test_client_ip.py | |
parent | 485886d8f9a665e9c416a98dd00e5c836b6bf27c (diff) | |
download | unit-e53ce40c5854d95722cdfc198626fcd5aecbe563.tar.gz unit-e53ce40c5854d95722cdfc198626fcd5aecbe563.tar.bz2 |
Tests: removed TestApplicationTLS.get_server_certificate().
distutils.version is replaced by packaging.version. Also minor style fixes.
Diffstat (limited to 'test/test_client_ip.py')
-rw-r--r-- | test/test_client_ip.py | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/test/test_client_ip.py b/test/test_client_ip.py index 4b2b2fa1..53e52201 100644 --- a/test/test_client_ip.py +++ b/test/test_client_ip.py @@ -7,10 +7,14 @@ class TestClientIP(TestApplicationPython): def client_ip(self, options): assert 'success' in self.conf( { - "127.0.0.1:7081": - {"client_ip": options, "pass": "applications/client_ip"}, - "[::1]:7082": - {"client_ip": options, "pass": "applications/client_ip"}, + "127.0.0.1:7081": { + "client_ip": options, + "pass": "applications/client_ip", + }, + "[::1]:7082": { + "client_ip": options, + "pass": "applications/client_ip", + }, }, 'listeners', ), 'listeners configure' @@ -48,9 +52,7 @@ class TestClientIP(TestApplicationPython): ), 'ipv6 default 2' assert self.get_xff('1.1.1.1') == '1.1.1.1', 'replace' assert self.get_xff('blah') == '127.0.0.1', 'bad header 2' - assert ( - self.get_xff('1.1.1.1', 'ipv6') == '::1' - ), 'bad source ipv6 2' + assert self.get_xff('1.1.1.1', 'ipv6') == '::1', 'bad source ipv6 2' self.client_ip({'header': 'X-Forwarded-For', 'source': '!127.0.0.1'}) @@ -118,10 +120,18 @@ class TestClientIP(TestApplicationPython): def test_settings_client_ip_invalid(self): assert 'error' in self.conf( - {"http": {"client_ip": {'header': 'X-Forwarded-For', 'source': []}}}, + { + "http": { + "client_ip": {'header': 'X-Forwarded-For', 'source': []} + } + }, 'settings', ), 'empty array source' assert 'error' in self.conf( - {"http":{"client_ip": {'header': 'X-Forwarded-For', 'source': 'a'}}}, + { + "http": { + "client_ip": {'header': 'X-Forwarded-For', 'source': 'a'} + } + }, 'settings', ), 'empty source invalid' |