summaryrefslogtreecommitdiffhomepage
path: root/test/test_static_chroot.py
diff options
context:
space:
mode:
authorZhidao HONG <z.hong@f5.com>2021-09-30 22:17:28 +0800
committerZhidao HONG <z.hong@f5.com>2021-09-30 22:17:28 +0800
commitc5220944d2acdb912c129fc82ac8a83d24e9845d (patch)
tree8cea32d295c7bde273cfe3a14b6044463aaec155 /test/test_static_chroot.py
parent37144d68499217d086c26a2030e6e9f6f7342152 (diff)
downloadunit-c5220944d2acdb912c129fc82ac8a83d24e9845d.tar.gz
unit-c5220944d2acdb912c129fc82ac8a83d24e9845d.tar.bz2
Static: variables in the "share" option.
This commit supports variable in the "share" option, the finding path to file serve is the value from "share". An example: { "share": "/www/data/static$uri" }
Diffstat (limited to 'test/test_static_chroot.py')
-rw-r--r--test/test_static_chroot.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/test_static_chroot.py b/test/test_static_chroot.py
index f9bc93a8..aa2952a1 100644
--- a/test/test_static_chroot.py
+++ b/test/test_static_chroot.py
@@ -21,7 +21,7 @@ class TestStaticChroot(TestApplicationProto):
self._load_conf(
{
"listeners": {"*:7080": {"pass": "routes"}},
- "routes": [{"action": {"share": temp_dir + "/assets"}}],
+ "routes": [{"action": {"share": temp_dir + "/assets$uri"}}],
}
)
@@ -31,7 +31,7 @@ class TestStaticChroot(TestApplicationProto):
assert 'success' in self.conf(
{
- "share": temp_dir + "/assets",
+ "share": temp_dir + "/assets$uri",
"chroot": temp_dir + "/assets/dir",
},
'routes/0/action',
@@ -49,7 +49,7 @@ class TestStaticChroot(TestApplicationProto):
assert 'success' in self.conf(
{
- "share": temp_dir + "/assets",
+ "share": temp_dir + "/assets$uri",
"chroot": temp_dir + "/assets/dir",
},
'routes/0/action',
@@ -59,7 +59,8 @@ class TestStaticChroot(TestApplicationProto):
def test_static_chroot_empty(self, temp_dir):
assert 'success' in self.conf(
- {"share": temp_dir + "/assets", "chroot": ""}, 'routes/0/action',
+ {"share": temp_dir + "/assets$uri", "chroot": ""},
+ 'routes/0/action',
), 'configure chroot empty absolute'
assert (
@@ -67,7 +68,7 @@ class TestStaticChroot(TestApplicationProto):
), 'chroot empty absolute'
assert 'success' in self.conf(
- {"share": ".", "chroot": ""}, 'routes/0/action',
+ {"share": ".$uri", "chroot": ""}, 'routes/0/action',
), 'configure chroot empty relative'
assert (
@@ -79,19 +80,20 @@ class TestStaticChroot(TestApplicationProto):
pytest.skip('does\'t work under root')
assert 'success' in self.conf(
- {"share": temp_dir + "/assets", "chroot": "."}, 'routes/0/action',
+ {"share": temp_dir + "/assets$uri", "chroot": "."},
+ 'routes/0/action',
), 'configure relative chroot'
assert self.get(url='/dir/file')['status'] == 403, 'relative chroot'
assert 'success' in self.conf(
- {"share": "."}, 'routes/0/action',
+ {"share": ".$uri"}, 'routes/0/action',
), 'configure relative share'
assert self.get(url=self.test_path)['status'] == 200, 'relative share'
assert 'success' in self.conf(
- {"share": ".", "chroot": "."}, 'routes/0/action',
+ {"share": ".$uri", "chroot": "."}, 'routes/0/action',
), 'configure relative'
assert self.get(url=self.test_path)['status'] == 200, 'relative'