summaryrefslogtreecommitdiffhomepage
path: root/test/test_asgi_application.py
diff options
context:
space:
mode:
authorKonstantin Pavlov <thresh@nginx.com>2023-05-10 10:29:16 -0700
committerKonstantin Pavlov <thresh@nginx.com>2023-05-10 10:29:16 -0700
commit69235c513277c64b513447d9b92c3c03d616f577 (patch)
tree0780c92ba28d92b547c85ea0bee5e3040e14dee2 /test/test_asgi_application.py
parentb9bc222021e77bbdfb12576b3e315b962cf6b399 (diff)
parentfaf97dc06058de1c929af33a68adb34d3932b374 (diff)
downloadunit-1.30.0-1.tar.gz
unit-1.30.0-1.tar.bz2
Merged with the default branch.1.30.0-1
Diffstat (limited to '')
-rw-r--r--test/test_asgi_application.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/test/test_asgi_application.py b/test/test_asgi_application.py
index 121a2fbc..5ce82cb2 100644
--- a/test/test_asgi_application.py
+++ b/test/test_asgi_application.py
@@ -20,17 +20,16 @@ class TestASGIApplication(TestApplicationPython):
body = 'Test body string.'
resp = self.http(
- b"""POST / HTTP/1.1
+ f"""POST / HTTP/1.1
Host: localhost
-Content-Length: %d
+Content-Length: {len(body)}
Custom-Header: blah
Custom-hEader: Blah
Content-Type: text/html
Connection: close
custom-header: BLAH
-%s"""
- % (len(body), body.encode()),
+{body}""".encode(),
raw=True,
)
@@ -63,9 +62,9 @@ custom-header: BLAH
def test_asgi_application_unix(self, temp_dir):
self.load('empty')
- addr = temp_dir + '/sock'
+ addr = f'{temp_dir}/sock'
assert 'success' in self.conf(
- {"unix:" + addr: {"pass": "applications/empty"}}, 'listeners'
+ {f"unix:{addr}": {"pass": "applications/empty"}}, 'listeners'
)
assert self.get(sock_type='unix', addr=addr)['status'] == 200
@@ -83,7 +82,7 @@ custom-header: BLAH
self.load('prefix', prefix='/api/rest')
def set_prefix(prefix):
- self.conf('"' + prefix + '"', 'applications/prefix/prefix')
+ self.conf(f'"{prefix}"', 'applications/prefix/prefix')
def check_prefix(url, prefix):
resp = self.get(url=url)
@@ -190,7 +189,7 @@ custom-header: BLAH
max_body_size = 12 * 1024 * 1024
assert 'success' in self.conf(
- '{"http":{"max_body_size": ' + str(max_body_size) + ' }}',
+ f'{{"http":{{"max_body_size": {max_body_size} }}}}',
'settings',
)