MCPcopy
hub / github.com/django/django / test_raise_exception

Method test_raise_exception

tests/auth_tests/test_mixins.py:168–175  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

166 self._test_redirect(AView.as_view(), "/accounts/login/")
167
168 def test_raise_exception(self):
169 class AView(AlwaysFalseView):
170 raise_exception = True
171
172 request = self.factory.get("/rand")
173 request.user = AnonymousUser()
174 with self.assertRaises(PermissionDenied):
175 AView.as_view()(request)
176
177 def test_raise_exception_custom_message(self):
178 msg = "You don't have access here"

Callers

nothing calls this directly

Calls 3

AnonymousUserClass · 0.90
getMethod · 0.45
as_viewMethod · 0.45

Tested by

no test coverage detected