summaryrefslogtreecommitdiffhomepage
path: root/test/test_static_fallback.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_static_fallback.py')
-rw-r--r--test/test_static_fallback.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/test/test_static_fallback.py b/test/test_static_fallback.py
index 1f1a1df7..75012bbb 100644
--- a/test/test_static_fallback.py
+++ b/test/test_static_fallback.py
@@ -10,11 +10,12 @@ class TestStaticFallback(TestApplicationProto):
@pytest.fixture(autouse=True)
def setup_method_fixture(self, temp_dir):
- os.makedirs(temp_dir + '/assets/dir')
- Path(temp_dir + '/assets/index.html').write_text('0123456789')
+ assets_dir = f'{temp_dir}/assets'
+ os.makedirs(f'{assets_dir}/dir')
+ Path(f'{assets_dir}/index.html').write_text('0123456789')
- os.makedirs(temp_dir + '/assets/403')
- os.chmod(temp_dir + '/assets/403', 0o000)
+ os.makedirs(f'{assets_dir}/403')
+ os.chmod(f'{assets_dir}/403', 0o000)
self._load_conf(
{
@@ -22,7 +23,7 @@ class TestStaticFallback(TestApplicationProto):
"*:7080": {"pass": "routes"},
"*:7081": {"pass": "routes"},
},
- "routes": [{"action": {"share": temp_dir + "/assets$uri"}}],
+ "routes": [{"action": {"share": f'{assets_dir}$uri'}}],
"applications": {},
}
)
@@ -30,7 +31,7 @@ class TestStaticFallback(TestApplicationProto):
yield
try:
- os.chmod(temp_dir + '/assets/403', 0o777)
+ os.chmod(f'{assets_dir}/403', 0o777)
except FileNotFoundError:
pass
@@ -49,7 +50,7 @@ class TestStaticFallback(TestApplicationProto):
def test_static_fallback_valid_path(self, temp_dir):
self.action_update(
- {"share": temp_dir + "/assets$uri", "fallback": {"return": 200}}
+ {"share": f"{temp_dir}/assets$uri", "fallback": {"return": 200}}
)
resp = self.get()
assert resp['status'] == 200, 'fallback status'
@@ -84,7 +85,7 @@ class TestStaticFallback(TestApplicationProto):
self.action_update(
{
"share": "/blah",
- "fallback": {"share": temp_dir + "/assets$uri"},
+ "fallback": {"share": f"{temp_dir}/assets$uri"},
}
)