Example #1
0
 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)
Example #2
0
 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())
Example #3
0
 def test_with_predicate_unmet_with_message(self):
     req = Request({}, make_user(None))
     self._check_enforcement(MockPredicate(False),
                             req,
                             expected_message="Go away")
Example #4
0
 def test_with_predicate_unmet(self):
     req = Request({}, make_user(None))
     self._check_enforcement(MockPredicate(False), req)
Example #5
0
 def test_with_predicate_met(self):
     req = Request({}, make_user(None))
     enforce(MockPredicate(), req)
Example #6
0
 def test_with_predicate_unmet(self):
     req = Request({}, make_user(None))
     ok_(not_met(MockPredicate(False), req))
Example #7
0
 def test_with_predicate_met(self):
     req = Request({}, make_user(None))
     assert_false(not_met(MockPredicate(), req))
Example #8
0
 def test_with_predicate_met(self):
     req = Request({}, make_user(None))
     ok_(is_met(MockPredicate(), req))
Example #9
0
 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")
Example #10
0
 def test_require_with_predicate_unmet(self):
     protected_view = require(MockPredicate(False))(mock_view)
     self._check_enforcement(protected_view)
Example #11
0
 def test_require_with_predicate_met(self):
     protected_view = require(MockPredicate())(mock_view)
     eq_(protected_view(self.req), "Got it")