Пример #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)
Пример #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())
Пример #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")
Пример #4
0
 def test_with_predicate_unmet(self):
     req = Request({}, make_user(None))
     self._check_enforcement(MockPredicate(False), req)
Пример #5
0
 def test_with_predicate_met(self):
     req = Request({}, make_user(None))
     enforce(MockPredicate(), req)
Пример #6
0
 def test_with_predicate_unmet(self):
     req = Request({}, make_user(None))
     ok_(not_met(MockPredicate(False), req))
Пример #7
0
 def test_with_predicate_met(self):
     req = Request({}, make_user(None))
     assert_false(not_met(MockPredicate(), req))
Пример #8
0
 def test_with_predicate_met(self):
     req = Request({}, make_user(None))
     ok_(is_met(MockPredicate(), req))
Пример #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")
Пример #10
0
 def test_require_with_predicate_unmet(self):
     protected_view = require(MockPredicate(False))(mock_view)
     self._check_enforcement(protected_view)
Пример #11
0
 def test_require_with_predicate_met(self):
     protected_view = require(MockPredicate())(mock_view)
     eq_(protected_view(self.req), "Got it")