diff options
| author | Andrei Belov <defan@nginx.com> | 2021-08-19 18:17:12 +0300 |
|---|---|---|
| committer | Andrei Belov <defan@nginx.com> | 2021-08-19 18:17:12 +0300 |
| commit | db442f1be7e713e6a219621ff97a51046590dbd6 (patch) | |
| tree | 913734275bc890ec175e51fcb0f36b01a3c52c24 /test/test_static_symlink.py | |
| parent | a1d2ced6fc2317d36bc917c5d0ac339bc647dc34 (diff) | |
| parent | 13c0025dfa6e041563d0ad5dd81679b44522694c (diff) | |
| download | unit-1.25.0-1.tar.gz unit-1.25.0-1.tar.bz2 | |
Merged with the default branch.1.25.0-1
Diffstat (limited to '')
| -rw-r--r-- | test/test_static_symlink.py (renamed from test/test_share_symlink.py) | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/test/test_share_symlink.py b/test/test_static_symlink.py index 3970b605..35eb402a 100644 --- a/test/test_share_symlink.py +++ b/test/test_static_symlink.py @@ -1,21 +1,19 @@ import os +from pathlib import Path import pytest from unit.applications.proto import TestApplicationProto -class TestShareSymlink(TestApplicationProto): +class TestStaticSymlink(TestApplicationProto): prerequisites = {'features': ['chroot']} @pytest.fixture(autouse=True) def setup_method_fixture(self, temp_dir): os.makedirs(temp_dir + '/assets/dir/dir') - with open(temp_dir + '/assets/index.html', 'w') as index, open( - temp_dir + '/assets/dir/file', 'w' - ) as file: - index.write('0123456789') - file.write('blah') + Path(temp_dir + '/assets/index.html').write_text('0123456789') + Path(temp_dir + '/assets/dir/file').write_text('blah') self._load_conf( { @@ -24,7 +22,7 @@ class TestShareSymlink(TestApplicationProto): } ) - def test_share_symlink(self, temp_dir, skip_alert): + def test_static_symlink(self, temp_dir, skip_alert): skip_alert(r'opening.*failed') os.symlink(temp_dir + '/assets/dir', temp_dir + '/assets/link') @@ -48,7 +46,7 @@ class TestShareSymlink(TestApplicationProto): assert self.get(url='/link/file')['status'] == 200, 'symlink enabled' - def test_share_symlink_two_blocks(self, temp_dir, skip_alert): + def test_static_symlink_two_blocks(self, temp_dir, skip_alert): skip_alert(r'opening.*failed') os.symlink(temp_dir + '/assets/dir', temp_dir + '/assets/link') @@ -76,7 +74,7 @@ class TestShareSymlink(TestApplicationProto): assert self.get(url='/link/file')['status'] == 200, 'block enabled' assert self.head(url='/link/file')['status'] == 403, 'block disabled' - def test_share_symlink_chroot(self, temp_dir, skip_alert): + def test_static_symlink_chroot(self, temp_dir, skip_alert): skip_alert(r'opening.*failed') os.symlink( |
