def _check_enforcement(self, predicate, request, expected_message=None, expected_denial_handler=None): """Make sure ``predicate`` is not met and enforced as expected.""" try: enforce(predicate, request, expected_message, expected_denial_handler) except _AuthorizationDenial, authz_denial: eq_(authz_denial.reason, expected_message) eq_(authz_denial.handler, expected_denial_handler)
def test_with_predicate_met(self): req = Request({}, make_user(None)) enforce(MockPredicate(), req)