Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
tw4l committed Apr 2, 2024
1 parent c27ff67 commit 7c5fa48
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions sample_archive/access/allow_all.aclj
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*, - {"access": "allow", "user": "staff"}
7 changes: 7 additions & 0 deletions tests/config_test_access.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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




4 changes: 4 additions & 0 deletions tests/test_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit 7c5fa48

Please sign in to comment.