From 3670c2cdb732d378ba6d38e72e7cd875ff726aa9 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 14 Oct 2018 21:11:41 -0500 Subject: move tests out of the package --- tests/pkgs/staticpermapp/__init__.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/pkgs/staticpermapp/__init__.py (limited to 'tests/pkgs/staticpermapp') diff --git a/tests/pkgs/staticpermapp/__init__.py b/tests/pkgs/staticpermapp/__init__.py new file mode 100644 index 000000000..cc690d937 --- /dev/null +++ b/tests/pkgs/staticpermapp/__init__.py @@ -0,0 +1,25 @@ +class RootFactory(object): + __acl__ = [('Allow', 'fred', 'view')] + def __init__(self, request): + pass + +class LocalRootFactory(object): + __acl__ = [('Allow', 'bob', 'view')] + def __init__(self, request): + pass + + +def includeme(config): + from pyramid.authentication import RemoteUserAuthenticationPolicy + from pyramid.authorization import ACLAuthorizationPolicy + authn_policy = RemoteUserAuthenticationPolicy() + authz_policy = ACLAuthorizationPolicy() + config._set_authentication_policy(authn_policy) + config._set_authorization_policy(authz_policy) + config.add_static_view('allowed', 'pyramid.tests:fixtures/static/') + config.add_static_view('protected', 'pyramid.tests:fixtures/static/', + permission='view') + config.add_static_view('factory_protected', + 'pyramid.tests:fixtures/static/', + permission='view', + factory=LocalRootFactory) -- cgit v1.2.3 From dd3cc81f75dcb5ff96e0751653071722a15f46c2 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Sun, 14 Oct 2018 23:16:48 -0500 Subject: fix the tests to import from the tests package instead of pyramid.tests --- tests/pkgs/staticpermapp/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/pkgs/staticpermapp') diff --git a/tests/pkgs/staticpermapp/__init__.py b/tests/pkgs/staticpermapp/__init__.py index cc690d937..b5038260f 100644 --- a/tests/pkgs/staticpermapp/__init__.py +++ b/tests/pkgs/staticpermapp/__init__.py @@ -16,10 +16,10 @@ def includeme(config): authz_policy = ACLAuthorizationPolicy() config._set_authentication_policy(authn_policy) config._set_authorization_policy(authz_policy) - config.add_static_view('allowed', 'pyramid.tests:fixtures/static/') - config.add_static_view('protected', 'pyramid.tests:fixtures/static/', + config.add_static_view('allowed', 'tests:fixtures/static/') + config.add_static_view('protected', 'tests:fixtures/static/', permission='view') config.add_static_view('factory_protected', - 'pyramid.tests:fixtures/static/', + 'tests:fixtures/static/', permission='view', factory=LocalRootFactory) -- cgit v1.2.3