summaryrefslogtreecommitdiffhomepage
path: root/test/test_variables.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_variables.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_variables.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/test/test_variables.py b/test/test_variables.py
index ecce5e6d..545d61e9 100644
--- a/test/test_variables.py
+++ b/test/test_variables.py
@@ -19,7 +19,7 @@ class TestVariables(TestApplicationProto):
def set_format(self, format):
assert 'success' in self.conf(
{
- 'path': option.temp_dir + '/access.log',
+ 'path': f'{option.temp_dir}/access.log',
'format': format,
},
'access_log',
@@ -36,7 +36,7 @@ class TestVariables(TestApplicationProto):
def check_dollar(location, expect):
assert 'success' in self.conf(
- '"' + location + '"',
+ f'"{location}"',
'routes/0/action/location',
)
assert self.get()['headers']['Location'] == expect
@@ -93,7 +93,7 @@ Connection: close
self.set_format('$request_uri')
def check_request_uri(req_uri):
- reg = r'^' + re.escape(req_uri) + r'$'
+ reg = fr'^{re.escape(req_uri)}$'
assert self.search_in_log(reg) is None
assert self.get(url=req_uri)['status'] == 200
@@ -109,7 +109,7 @@ Connection: close
def check_uri(uri, expect=None):
expect = uri if expect is None else expect
- reg = r'^' + re.escape(expect) + r'$'
+ reg = fr'^{re.escape(expect)}$'
assert self.search_in_log(reg) is None
assert self.get(url=uri)['status'] == 200
@@ -125,7 +125,7 @@ Connection: close
def check_host(host, expect=None):
expect = host if expect is None else expect
- reg = r'^' + re.escape(expect) + r'$'
+ reg = fr'^{re.escape(expect)}$'
assert self.search_in_log(reg) is None
assert (
@@ -196,7 +196,7 @@ Connection: close
self.set_format('$method $header_referer')
def check_referer(referer):
- reg = r'^GET ' + re.escape(referer) + r'$'
+ reg = fr'^GET {re.escape(referer)}$'
assert self.search_in_log(reg) is None
assert (
@@ -219,7 +219,7 @@ Connection: close
self.set_format('$method $header_user_agent')
def check_user_agent(user_agent):
- reg = r'^GET ' + re.escape(user_agent) + r'$'
+ reg = fr'^GET {re.escape(user_agent)}$'
assert self.search_in_log(reg) is None
assert (
@@ -240,7 +240,7 @@ Connection: close
def test_variables_many(self):
def check_vars(uri, expect):
- reg = r'^' + re.escape(expect) + r'$'
+ reg = fr'^{re.escape(expect)}$'
assert self.search_in_log(reg) is None
assert self.get(url=uri)['status'] == 200
@@ -273,7 +273,7 @@ Connection: close
def test_variables_dynamic_arguments(self):
def check_arg(url, expect=None):
expect = url if expect is None else expect
- reg = r'^' + re.escape(expect) + r'$'
+ reg = fr'^{re.escape(expect)}$'
assert self.search_in_log(reg) is None
assert self.get(url=url)['status'] == 200
@@ -304,7 +304,7 @@ Connection: close
def test_variables_dynamic_headers(self):
def check_header(header, value):
- reg = r'^' + value + r'$'
+ reg = fr'^{value}$'
assert self.search_in_log(reg) is None
assert (
@@ -368,7 +368,7 @@ Connection: close
def check_variables(format):
assert 'error' in self.conf(
{
- 'path': option.temp_dir + '/access.log',
+ 'path': f'{option.temp_dir}/access.log',
'format': format,
},
'access_log',