summaryrefslogtreecommitdiffhomepage
path: root/test/test_routing.py
diff options
context:
space:
mode:
authorAndrei Belov <defan@nginx.com>2021-03-25 17:32:53 +0300
committerAndrei Belov <defan@nginx.com>2021-03-25 17:32:53 +0300
commit83d2ce0ae884f73a111f9b1807d5393a150bf116 (patch)
tree2c483a9eae55233df4e308c5232734e03622cee0 /test/test_routing.py
parentd2579d52b9583e5add0a71c6c7fb9f1b0c948a59 (diff)
parent3c969905bd6db6446b5213acb616e8c04ff546f4 (diff)
downloadunit-1.23.0-1.tar.gz
unit-1.23.0-1.tar.bz2
Merged with the default branch.1.23.0-1
Diffstat (limited to '')
-rw-r--r--test/test_routing.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_routing.py b/test/test_routing.py
index 4d27cb61..be9a1faf 100644
--- a/test/test_routing.py
+++ b/test/test_routing.py
@@ -229,6 +229,9 @@ class TestRouting(TestApplicationProto):
assert self.get(url='/ABc')['status'] == 404
def test_routes_empty_regex(self):
+ if not option.available['modules']['regex']:
+ pytest.skip('requires regex')
+
self.route_match({"uri":"~"})
assert self.get(url='/')['status'] == 200, 'empty regexp'
assert self.get(url='/anything')['status'] == 200, '/anything'
@@ -238,6 +241,9 @@ class TestRouting(TestApplicationProto):
assert self.get(url='/nothing')['status'] == 404, '/nothing'
def test_routes_bad_regex(self):
+ if not option.available['modules']['regex']:
+ pytest.skip('requires regex')
+
assert 'error' in self.route(
{"match": {"uri": "~/bl[ah"}, "action": {"return": 200}}
), 'bad regex'
@@ -255,6 +261,9 @@ class TestRouting(TestApplicationProto):
assert self.get(url='/nothing_z')['status'] == 500, '/nothing_z'
def test_routes_match_regex_case_sensitive(self):
+ if not option.available['modules']['regex']:
+ pytest.skip('requires regex')
+
self.route_match({"uri": "~/bl[ah]"})
assert self.get(url='/rlah')['status'] == 404, '/rlah'
@@ -263,6 +272,9 @@ class TestRouting(TestApplicationProto):
assert self.get(url='/BLAH')['status'] == 404, '/BLAH'
def test_routes_match_regex_negative_case_sensitive(self):
+ if not option.available['modules']['regex']:
+ pytest.skip('requires regex')
+
self.route_match({"uri": "!~/bl[ah]"})
assert self.get(url='/rlah')['status'] == 200, '/rlah'