def test_it_does_not_assign_create_permission_without_user_role( self, set_permissions, pyramid_request): set_permissions("acct:adminuser@foo", principals=["whatever"]) context = GroupRoot(pyramid_request) assert not pyramid_request.has_permission("create", context)
def test_it_assigns_create_permission_with_user_role( self, set_permissions, pyramid_request): set_permissions("acct:adminuser@foo", principals=[role.User]) context = GroupRoot(pyramid_request) assert pyramid_request.has_permission("create", context)
def test_it_does_not_assign_create_permission_without_user_role( self, pyramid_config, pyramid_request): policy = pyramid.authorization.ACLAuthorizationPolicy() pyramid_config.testing_securitypolicy('acct:adminuser@foo', ['whatever']) pyramid_config.set_authorization_policy(policy) context = GroupRoot(pyramid_request) assert not pyramid_request.has_permission('create', context)
def test_it_assigns_create_permission_with_user_role( self, pyramid_config, pyramid_request): policy = pyramid.authorization.ACLAuthorizationPolicy() pyramid_config.testing_securitypolicy("acct:adminuser@foo", [role.User]) pyramid_config.set_authorization_policy(policy) context = GroupRoot(pyramid_request) assert pyramid_request.has_permission("create", context)
def group_factory(self, pyramid_request): return GroupRoot(pyramid_request)