From 42a2916fe39fe5bce7fa6be9d98adb9bfa86c6ef Mon Sep 17 00:00:00 2001 From: Tessa Walsh Date: Tue, 13 Feb 2024 12:33:37 -0500 Subject: [PATCH] Add test --- sample_archive/access/allow_all.aclj | 1 + tests/config_test_access.yaml | 7 +++++++ tests/test_acl.py | 4 ++++ 3 files changed, 12 insertions(+) create mode 100644 sample_archive/access/allow_all.aclj diff --git a/sample_archive/access/allow_all.aclj b/sample_archive/access/allow_all.aclj new file mode 100644 index 000000000..1e93abe4a --- /dev/null +++ b/sample_archive/access/allow_all.aclj @@ -0,0 +1 @@ +*, - {"access": "allow", "user": "staff"} diff --git a/tests/config_test_access.yaml b/tests/config_test_access.yaml index 8fb352f7c..332d5a742 100644 --- a/tests/config_test_access.yaml +++ b/tests/config_test_access.yaml @@ -62,6 +62,13 @@ collections: acl_paths: - ./sample_archive/access/pywb.aclj + pywb-wildcard-surt: + index_paths: ./sample_archive/cdx/ + archive_paths: ./sample_archive/warcs/ + default_access: block + acl_paths: + - ./sample_archive/access/allow_all.aclj + diff --git a/tests/test_acl.py b/tests/test_acl.py index ea7655aa8..4e94962c5 100644 --- a/tests/test_acl.py +++ b/tests/test_acl.py @@ -96,5 +96,9 @@ def test_allowed_different_coll_acl_dir(self): assert '"http://httpbin.org/anything/resource.json"' in resp.text + def test_allow_all_acl_user_specific(self): + resp = self.testapp.get('/pywb-wildcard-surt/mp_/http://example.com/', status=451) + assert 'Access Blocked' in resp.text + resp = self.testapp.get('/pywb-wildcard-surt/mp_/http://example.com/', headers={"X-Pywb-Acl-User": "staff"}, status=200)