summaryrefslogtreecommitdiff
path: root/tests/pkgs/staticpermapp
diff options
context:
space:
mode:
authorMichael Merickel <michael@merickel.org>2018-10-14 21:11:41 -0500
committerMichael Merickel <michael@merickel.org>2018-10-14 21:11:41 -0500
commit3670c2cdb732d378ba6d38e72e7cd875ff726aa9 (patch)
tree5213452a778c992d42602efe7d3b3655a349abd5 /tests/pkgs/staticpermapp
parent2b024920847481592b1a13d4006d2a9fa8881d72 (diff)
downloadpyramid-3670c2cdb732d378ba6d38e72e7cd875ff726aa9.tar.gz
pyramid-3670c2cdb732d378ba6d38e72e7cd875ff726aa9.tar.bz2
pyramid-3670c2cdb732d378ba6d38e72e7cd875ff726aa9.zip
move tests out of the package
Diffstat (limited to 'tests/pkgs/staticpermapp')
-rw-r--r--tests/pkgs/staticpermapp/__init__.py25
1 files changed, 25 insertions, 0 deletions
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)