diff options
author | Andrei Zeliankou <zelenkov@nginx.com> | 2022-04-11 21:05:14 +0100 |
---|---|---|
committer | Andrei Zeliankou <zelenkov@nginx.com> | 2022-04-11 21:05:14 +0100 |
commit | 0f725346603f4de4473d12da502104b188ac02a4 (patch) | |
tree | 7f8254a816965d49c4d6d98da34f00c81894f7e8 /test/test_static.py | |
parent | aeed86c6829c62359e79f239b849766efb8857a7 (diff) | |
download | unit-0f725346603f4de4473d12da502104b188ac02a4.tar.gz unit-0f725346603f4de4473d12da502104b188ac02a4.tar.bz2 |
Tests: style.
Diffstat (limited to 'test/test_static.py')
-rw-r--r-- | test/test_static.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/test/test_static.py b/test/test_static.py index 1d9c754a..5ec49f38 100644 --- a/test/test_static.py +++ b/test/test_static.py @@ -133,7 +133,8 @@ class TestStatic(TestApplicationProto): def test_static_space_in_name(self, temp_dir): os.rename( - temp_dir + '/assets/dir/file', temp_dir + '/assets/dir/fi le', + temp_dir + '/assets/dir/file', + temp_dir + '/assets/dir/fi le', ) assert waitforfiles(temp_dir + '/assets/dir/fi le') assert self.get(url='/dir/fi le')['body'] == 'blah', 'file name' @@ -154,9 +155,7 @@ class TestStatic(TestApplicationProto): assert ( self.get(url='/ di r %2Ffi le')['body'] == 'blah' ), 'slash encoded' - assert ( - self.get(url='/ di r /fi%20le')['body'] == 'blah' - ), 'file encoded' + assert self.get(url='/ di r /fi%20le')['body'] == 'blah', 'file encoded' assert ( self.get(url='/%20di%20r%20%2Ffi%20le')['body'] == 'blah' ), 'encoded' @@ -195,7 +194,8 @@ class TestStatic(TestApplicationProto): ), 'file name 2' os.rename( - temp_dir + '/assets/ di r ', temp_dir + '/assets/ди ректория', + temp_dir + '/assets/ di r ', + temp_dir + '/assets/ди ректория', ) assert waitforfiles(temp_dir + '/assets/ди ректория/фа йл') assert ( @@ -266,13 +266,14 @@ class TestStatic(TestApplicationProto): self.get(url='/')['headers']['Content-Type'] == 'text/plain' ), 'mime_types index default' assert ( - self.get(url='/dir/file')['headers']['Content-Type'] - == 'text/plain' + self.get(url='/dir/file')['headers']['Content-Type'] == 'text/plain' ), 'mime_types file in dir' def test_static_mime_types_partial_match(self): assert 'success' in self.conf( - {"text/x-blah": ["ile", "fil", "f", "e", ".file"],}, + { + "text/x-blah": ["ile", "fil", "f", "e", ".file"], + }, 'settings/http/static/mime_types', ), 'configure mime_types' assert 'Content-Type' not in self.get(url='/dir/file'), 'partial match' @@ -313,16 +314,14 @@ class TestStatic(TestApplicationProto): '"file"', 'settings/http/static/mime_types/text%2Fplain' ), 'mime_types add array element' assert ( - self.get(url='/dir/file')['headers']['Content-Type'] - == 'text/plain' + self.get(url='/dir/file')['headers']['Content-Type'] == 'text/plain' ), 'mime_types reverted' assert 'success' in self.conf( '"file"', 'settings/http/static/mime_types/text%2Fplain' ), 'configure mime_types update' assert ( - self.get(url='/dir/file')['headers']['Content-Type'] - == 'text/plain' + self.get(url='/dir/file')['headers']['Content-Type'] == 'text/plain' ), 'mime_types updated' assert ( 'Content-Type' not in self.get(url='/log.log')['headers'] @@ -346,7 +345,10 @@ class TestStatic(TestApplicationProto): 'settings/http/static/mime_types', ), 'mime_types same extensions array' assert 'error' in self.conf( - {"text/x-code": [".h", ".c", "readme"], "text/plain": "README",}, + { + "text/x-code": [".h", ".c", "readme"], + "text/plain": "README", + }, 'settings/http/static/mime_types', ), 'mime_types same extensions case insensitive' |