Beispiel #1
0
    def test_it_does_not_assign_update_permission_without_user_role(
            self, set_permissions, pyramid_request):
        set_permissions("acct:adminuser@foo", principals=["whatever"])

        context = ProfileRoot(pyramid_request)

        assert not pyramid_request.has_permission("update", context)
Beispiel #2
0
    def test_it_assigns_update_permission_with_user_role(
            self, set_permissions, pyramid_request):
        set_permissions("acct:adminuser@foo", principals=[role.User])

        context = ProfileRoot(pyramid_request)

        assert pyramid_request.has_permission("update", context)
Beispiel #3
0
    def test_it_does_not_assign_update_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 = ProfileRoot(pyramid_request)

        assert not pyramid_request.has_permission('update', context)
Beispiel #4
0
    def test_it_assigns_update_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 = ProfileRoot(pyramid_request)

        assert pyramid_request.has_permission("update", context)