Tests: minor fixes.
This commit is contained in:
@@ -1041,83 +1041,31 @@ class TestRouting(TestApplicationProto):
|
||||
}
|
||||
)
|
||||
|
||||
def check_headers(hds):
|
||||
hds = dict({"Host": "localhost", "Connection": "close"}, **hds)
|
||||
assert (
|
||||
self.get(headers=hds)['status'] == 200
|
||||
), 'headers array match'
|
||||
|
||||
def check_headers_404(hds):
|
||||
hds = dict({"Host": "localhost", "Connection": "close"}, **hds)
|
||||
assert (
|
||||
self.get(headers=hds)['status'] == 404
|
||||
), 'headers array no match'
|
||||
|
||||
assert self.get()['status'] == 404, 'match headers array'
|
||||
assert (
|
||||
self.get(
|
||||
headers={
|
||||
"Host": "localhost",
|
||||
"x-header1": "foo123",
|
||||
"Connection": "close",
|
||||
}
|
||||
)['status']
|
||||
== 200
|
||||
), 'match headers array 2'
|
||||
assert (
|
||||
self.get(
|
||||
headers={
|
||||
"Host": "localhost",
|
||||
"x-header2": "bar",
|
||||
"Connection": "close",
|
||||
}
|
||||
)['status']
|
||||
== 200
|
||||
), 'match headers array 3'
|
||||
assert (
|
||||
self.get(
|
||||
headers={
|
||||
"Host": "localhost",
|
||||
"x-header3": "bar",
|
||||
"Connection": "close",
|
||||
}
|
||||
)['status']
|
||||
== 200
|
||||
), 'match headers array 4'
|
||||
assert (
|
||||
self.get(
|
||||
headers={
|
||||
"Host": "localhost",
|
||||
"x-header1": "bar",
|
||||
"Connection": "close",
|
||||
}
|
||||
)['status']
|
||||
== 404
|
||||
), 'match headers array 5'
|
||||
assert (
|
||||
self.get(
|
||||
headers={
|
||||
"Host": "localhost",
|
||||
"x-header1": "bar",
|
||||
"x-header4": "foo",
|
||||
"Connection": "close",
|
||||
}
|
||||
)['status']
|
||||
== 200
|
||||
), 'match headers array 6'
|
||||
check_headers({"x-header1": "foo123"})
|
||||
check_headers({"x-header2": "bar"})
|
||||
check_headers({"x-header3": "bar"})
|
||||
check_headers_404({"x-header1": "bar"})
|
||||
check_headers({"x-header1": "bar", "x-header4": "foo"})
|
||||
|
||||
assert 'success' in self.conf_delete(
|
||||
'routes/0/match/headers/1'
|
||||
), 'match headers array configure 2'
|
||||
|
||||
assert (
|
||||
self.get(
|
||||
headers={
|
||||
"Host": "localhost",
|
||||
"x-header2": "bar",
|
||||
"Connection": "close",
|
||||
}
|
||||
)['status']
|
||||
== 404
|
||||
), 'match headers array 7'
|
||||
assert (
|
||||
self.get(
|
||||
headers={
|
||||
"Host": "localhost",
|
||||
"x-header3": "foo",
|
||||
"Connection": "close",
|
||||
}
|
||||
)['status']
|
||||
== 200
|
||||
), 'match headers array 8'
|
||||
check_headers_404({"x-header2": "bar"})
|
||||
check_headers({"x-header3": "foo"})
|
||||
|
||||
def test_routes_match_arguments(self):
|
||||
self.route_match({"arguments": {"foo": "bar"}})
|
||||
|
||||
@@ -70,8 +70,8 @@ class TestShareMount(TestApplicationProto):
|
||||
skip_alert(r'opening.*failed')
|
||||
|
||||
resp = self.get(url='/mount/')
|
||||
resp['status'] == 200
|
||||
resp['body'] == 'mount'
|
||||
assert resp['status'] == 200
|
||||
assert resp['body'] == 'mount'
|
||||
|
||||
assert 'success' in self.conf(
|
||||
{"share": temp_dir + "/assets/dir", "traverse_mounts": False},
|
||||
@@ -86,8 +86,8 @@ class TestShareMount(TestApplicationProto):
|
||||
), 'configure mount enable'
|
||||
|
||||
resp = self.get(url='/mount/')
|
||||
resp['status'] == 200
|
||||
resp['body'] == 'mount'
|
||||
assert resp['status'] == 200
|
||||
assert resp['body'] == 'mount'
|
||||
|
||||
def test_share_mount_two_blocks(self, temp_dir, skip_alert):
|
||||
skip_alert(r'opening.*failed')
|
||||
@@ -128,7 +128,7 @@ class TestShareMount(TestApplicationProto):
|
||||
'routes/0/action',
|
||||
), 'configure chroot mount default'
|
||||
|
||||
self.get(url='/mount/')['status'] == 200, 'chroot'
|
||||
assert self.get(url='/mount/')['status'] == 200, 'chroot'
|
||||
|
||||
assert 'success' in self.conf(
|
||||
{
|
||||
@@ -139,4 +139,4 @@ class TestShareMount(TestApplicationProto):
|
||||
'routes/0/action',
|
||||
), 'configure chroot mount disable'
|
||||
|
||||
self.get(url='/mount/')['status'] == 403, 'chroot mount'
|
||||
assert self.get(url='/mount/')['status'] == 403, 'chroot mount'
|
||||
|
||||
Reference in New Issue
Block a user