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/defpermbugapp/__init__.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/pkgs/defpermbugapp/__init__.py (limited to 'tests/pkgs/defpermbugapp') diff --git a/tests/pkgs/defpermbugapp/__init__.py b/tests/pkgs/defpermbugapp/__init__.py new file mode 100644 index 000000000..032e8c626 --- /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('pyramid.tests.pkgs.defpermbugapp') + config._set_authentication_policy(authn_policy) + config._set_authorization_policy(authz_policy) + config.set_default_permission('private') + -- 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/defpermbugapp/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/pkgs/defpermbugapp') diff --git a/tests/pkgs/defpermbugapp/__init__.py b/tests/pkgs/defpermbugapp/__init__.py index 032e8c626..3e59aa623 100644 --- a/tests/pkgs/defpermbugapp/__init__.py +++ b/tests/pkgs/defpermbugapp/__init__.py @@ -19,7 +19,7 @@ def includeme(config): from pyramid.authentication import AuthTktAuthenticationPolicy authn_policy = AuthTktAuthenticationPolicy('seekt1t', hashalg='sha512') authz_policy = ACLAuthorizationPolicy() - config.scan('pyramid.tests.pkgs.defpermbugapp') + config.scan('tests.pkgs.defpermbugapp') config._set_authentication_policy(authn_policy) config._set_authorization_policy(authz_policy) config.set_default_permission('private') -- cgit v1.2.3