def test_it_assigns_create_permission_to_auth_client_role( self, set_permissions, pyramid_request): set_permissions("acct:adminuser@foo", principals=[role.AuthClient]) context = UserRoot(pyramid_request) assert pyramid_request.has_permission("create", context)
def test_it_does_not_assign_create_permission_without_auth_client_role( self, pyramid_config, pyramid_request): policy = pyramid.authorization.ACLAuthorizationPolicy() pyramid_config.testing_securitypolicy('acct:adminuser@foo') pyramid_config.set_authorization_policy(policy) context = UserRoot(pyramid_request) assert not pyramid_request.has_permission('create', context)
def test_it_assigns_create_permission_to_auth_client_role( self, pyramid_config, pyramid_request): policy = pyramid.authorization.ACLAuthorizationPolicy() pyramid_config.testing_securitypolicy('acct:adminuser@foo', groupids=[role.AuthClient]) pyramid_config.set_authorization_policy(policy) context = UserRoot(pyramid_request) assert pyramid_request.has_permission('create', context)
def user_factory(self, pyramid_request): return UserRoot(pyramid_request)