mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
custom processing ops, of which perms is a specific type add lazy_ops test to ensure all cdx processing ops are lazy perms: set up a 'perms policy' factory and perms policy implementation perms policy setting results in a custom processing op update tests to work with new config IndexReader handles both cdx server + perms policy
29 lines
842 B
Python
29 lines
842 B
Python
from pywb.cdx.cdxops import cdx_load
|
|
from pywb.cdx.query import CDXQuery
|
|
from pywb.cdx.cdxserver import CDXServer
|
|
from pywb.utils.wbexception import AccessException
|
|
from pywb.core.indexreader import IndexReader
|
|
|
|
#from pywb.perms.perms_filter import AllowAllPerms
|
|
|
|
from pytest import raises
|
|
|
|
from tests.fixture import TestExclusionPermsPolicy, testconfig
|
|
|
|
|
|
#================================================================
|
|
def test_excluded(testconfig):
|
|
sources = testconfig.get('index_paths')
|
|
perms_policy = testconfig.get('perms_policy')
|
|
|
|
cdx_server = CDXServer(sources)
|
|
index_reader = IndexReader(cdx_server, perms_policy)
|
|
|
|
url = 'http://www.iana.org/_img/bookmark_icon.ico'
|
|
|
|
params = dict(url=url)
|
|
|
|
with raises(AccessException):
|
|
cdxobjs = list(index_reader.load_cdx(None, params))
|
|
print cdxobjs
|