def test_require_with_predicate_unmet_with_denial_handler(self): denial_handler = object() protected_view = require( MockPredicate(False), denial_handler=denial_handler, )(mock_view) self._check_enforcement(protected_view, expected_denial_handler=denial_handler)
def test_with_predicate_unmet_with_message_and_denial_handler(self): req = Request({}, make_user(None)) self._check_enforcement(MockPredicate(False), req, expected_message="Go away", expected_denial_handler=object())
def test_with_predicate_unmet_with_message(self): req = Request({}, make_user(None)) self._check_enforcement(MockPredicate(False), req, expected_message="Go away")
def test_with_predicate_unmet(self): req = Request({}, make_user(None)) self._check_enforcement(MockPredicate(False), req)
def test_with_predicate_met(self): req = Request({}, make_user(None)) enforce(MockPredicate(), req)
def test_with_predicate_unmet(self): req = Request({}, make_user(None)) ok_(not_met(MockPredicate(False), req))
def test_with_predicate_met(self): req = Request({}, make_user(None)) assert_false(not_met(MockPredicate(), req))
def test_with_predicate_met(self): req = Request({}, make_user(None)) ok_(is_met(MockPredicate(), req))
def test_require_with_predicate_unmet_with_message(self): protected_view = require(MockPredicate(False), "Go away")(mock_view) self._check_enforcement(protected_view, expected_message="Go away")
def test_require_with_predicate_unmet(self): protected_view = require(MockPredicate(False))(mock_view) self._check_enforcement(protected_view)
def test_require_with_predicate_met(self): protected_view = require(MockPredicate())(mock_view) eq_(protected_view(self.req), "Got it")