1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 08:04:49 +01:00
pywb/tests_disabled/perms_fixture.py
Ilya Kreymer a4b770d34e new-pywb refactor!
frontendapp compatibility
- add support for separate not found page for 404s (not_found.html)
- support for exception handling with error template (error.html)
- support for home page (index.html)
- add memento headers for replay
- add referrer fallback check
- tests: port integration tests for front-end replay, cdx server
- not included: proxy mode, exact redirect mode, non-framed replay
- move unused tests to tests_disabled
- cli: add optional werkzeug profiler with --profile flag
2017-02-27 19:07:51 -08:00

35 lines
976 B
Python

"""
An example perms policy used as a testing fixture
this policy is enabled by adding the following setting to the
main config.yaml
perms_policy: !!python/name:pywb.perms.test.test_perms_policy.perms_policy
"""
from pywb.perms.perms_filter import Perms
#================================================================
class TestExclusionPerms(Perms):
"""
Perm Checker fixture to block a single url for testing
"""
# sample_archive has captures for this URLKEY
URLKEY_EXCLUDED = b'org,iana)/_img/bookmark_icon.ico'
def allow_url_lookup(self, urlkey):
"""
Return true/false if url (canonicalized url)
should be allowed
"""
print(urlkey)
if urlkey == self.URLKEY_EXCLUDED:
return False
return super(TestExclusionPerms, self).allow_url_lookup(urlkey)
#================================================================
def perms_policy(wbrequest):
return TestExclusionPerms()