def test_authz_denied(self): """Authorization would be denied if it's denied!.""" assert_false(can_access("/app1/admin", self.request)) eq_(len(self.log_fixture.handler.messages['debug']), 1) eq_(self.log_fixture.handler.messages['debug'][0], "Authorization would be denied on ingress to %s at /app1/admin" % repr(self.request.user))
def test_authz_granted(self): """Authorization would be granted if it's granted!.""" ok_(can_access("/app1/blog", self.request)) eq_(len(self.log_fixture.handler.messages['debug']), 1) eq_(self.log_fixture.handler.messages['debug'][0], "Authorization would be granted on ingress to %s at /app1/blog" % repr(self.request.user))
def test_no_authz_decision_made(self): """Authorization would be granted if no decision was made.""" ok_(can_access("/app2/nothing", self.request)) eq_(len(self.log_fixture.handler.messages['debug']), 1) eq_(self.log_fixture.handler.messages['debug'][0], "Authorization would be granted on ingress to %s at /app2/nothing" % repr(self.request.user))
def test_authz_denied(self): """Authorization would be denied if it's denied!.""" assert_false(can_access("/app1/admin", self.request)) eq_(len(self.log_fixture.handler.messages['debug']), 1) eq_( self.log_fixture.handler.messages['debug'][0], "Authorization would be denied on ingress to %s at /app1/admin" % repr(self.request.user))
def test_authz_granted(self): """Authorization would be granted if it's granted!.""" ok_(can_access("/app1/blog", self.request)) eq_(len(self.log_fixture.handler.messages['debug']), 1) eq_( self.log_fixture.handler.messages['debug'][0], "Authorization would be granted on ingress to %s at /app1/blog" % repr(self.request.user))
def test_no_authz_decision_made(self): """Authorization would be granted if no decision was made.""" ok_(can_access("/app2/nothing", self.request)) eq_(len(self.log_fixture.handler.messages['debug']), 1) eq_( self.log_fixture.handler.messages['debug'][0], "Authorization would be granted on ingress to %s at /app2/nothing" % repr(self.request.user))
def test_authz_denied_with_view_resolved(self): """ The view shouldn't be resolved if we are passing the view by hand. """ positional_args = () named_args = {} assert_false(can_access("/app1/admin", self.request, mock_view, positional_args, named_args)) eq_(len(self.log_fixture.handler.messages['debug']), 1) eq_(self.log_fixture.handler.messages['debug'][0], "Authorization would be denied on ingress to %s at /app1/admin" % repr(self.request.user))
def test_authz_denied_with_view_resolved(self): """ The view shouldn't be resolved if we are passing the view by hand. """ positional_args = () named_args = {} assert_false( can_access("/app1/admin", self.request, mock_view, positional_args, named_args)) eq_(len(self.log_fixture.handler.messages['debug']), 1) eq_( self.log_fixture.handler.messages['debug'][0], "Authorization would be denied on ingress to %s at /app1/admin" % repr(self.request.user))