diff options
| author | Michael Merickel <michael@merickel.org> | 2018-10-14 21:11:41 -0500 |
|---|---|---|
| committer | Michael Merickel <michael@merickel.org> | 2018-10-14 21:11:41 -0500 |
| commit | 3670c2cdb732d378ba6d38e72e7cd875ff726aa9 (patch) | |
| tree | 5213452a778c992d42602efe7d3b3655a349abd5 /tests/pkgs/permbugapp | |
| parent | 2b024920847481592b1a13d4006d2a9fa8881d72 (diff) | |
| download | pyramid-3670c2cdb732d378ba6d38e72e7cd875ff726aa9.tar.gz pyramid-3670c2cdb732d378ba6d38e72e7cd875ff726aa9.tar.bz2 pyramid-3670c2cdb732d378ba6d38e72e7cd875ff726aa9.zip | |
move tests out of the package
Diffstat (limited to 'tests/pkgs/permbugapp')
| -rw-r--r-- | tests/pkgs/permbugapp/__init__.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/pkgs/permbugapp/__init__.py b/tests/pkgs/permbugapp/__init__.py new file mode 100644 index 000000000..4868427a5 --- /dev/null +++ b/tests/pkgs/permbugapp/__init__.py @@ -0,0 +1,22 @@ +from pyramid.compat import escape +from pyramid.security import view_execution_permitted +from pyramid.response import Response + +def x_view(request): # pragma: no cover + return Response('this is private!') + +def test(context, request): + # should return false + msg = 'Allow ./x? %s' % repr(view_execution_permitted( + context, request, 'x')) + return Response(escape(msg)) + +def includeme(config): + from pyramid.authentication import AuthTktAuthenticationPolicy + from pyramid.authorization import ACLAuthorizationPolicy + authn_policy = AuthTktAuthenticationPolicy('seekt1t', hashalg='sha512') + authz_policy = ACLAuthorizationPolicy() + config.set_authentication_policy(authn_policy) + config.set_authorization_policy(authz_policy) + config.add_view(test, name='test') + config.add_view(x_view, name='x', permission='private') |
