diff options
| author | Michael Merickel <github@m.merickel.org> | 2018-10-15 09:03:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-10-15 09:03:53 -0500 |
| commit | 81576ee51564c49d5ff3c1c07f214f22a8438231 (patch) | |
| tree | 5b3fe0b39a0fc33d545733d821738845909f638c /tests/pkgs/defpermbugapp | |
| parent | 433efe06191a7007ca8c5bf8fafee5c7c1439ebb (diff) | |
| parent | 17e3abf320f6d9cd90f7e5a0352280c2fef584af (diff) | |
| download | pyramid-81576ee51564c49d5ff3c1c07f214f22a8438231.tar.gz pyramid-81576ee51564c49d5ff3c1c07f214f22a8438231.tar.bz2 pyramid-81576ee51564c49d5ff3c1c07f214f22a8438231.zip | |
Merge pull request #3387 from mmerickel/src-folder-refactor
refactor pyramid tests into a tests folder and package into a src folder
Diffstat (limited to 'tests/pkgs/defpermbugapp')
| -rw-r--r-- | tests/pkgs/defpermbugapp/__init__.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/pkgs/defpermbugapp/__init__.py b/tests/pkgs/defpermbugapp/__init__.py new file mode 100644 index 000000000..3e59aa623 --- /dev/null +++ b/tests/pkgs/defpermbugapp/__init__.py @@ -0,0 +1,26 @@ +from webob import Response +from pyramid.security import NO_PERMISSION_REQUIRED +from pyramid.view import view_config + +@view_config(name='x') +def x_view(request): # pragma: no cover + return Response('this is private!') + +@view_config(name='y', permission='private2') +def y_view(request): # pragma: no cover + return Response('this is private too!') + +@view_config(name='z', permission=NO_PERMISSION_REQUIRED) +def z_view(request): + return Response('this is public') + +def includeme(config): + from pyramid.authorization import ACLAuthorizationPolicy + from pyramid.authentication import AuthTktAuthenticationPolicy + authn_policy = AuthTktAuthenticationPolicy('seekt1t', hashalg='sha512') + authz_policy = ACLAuthorizationPolicy() + config.scan('tests.pkgs.defpermbugapp') + config._set_authentication_policy(authn_policy) + config._set_authorization_policy(authz_policy) + config.set_default_permission('private') + |
