Пример #1
0
 def test_get_token_for_exempt_view(self):
     """
     Check that get_token still works for a view decorated with 'csrf_exempt'.
     """
     req = self._get_GET_csrf_cookie_request()
     CsrfViewMiddleware().process_view(req, csrf_exempt(token_view), (), {})
     resp = token_view(req)
     self._check_token_present(resp)
Пример #2
0
 def test_process_request_csrf_cookie_no_token_exempt_view(self):
     """
     Check that if a CSRF cookie is present and no token, but the csrf_exempt
     decorator has been applied to the view, the middleware lets it through
     """
     req = self._get_POST_csrf_cookie_request()
     req2 = CsrfViewMiddleware().process_view(req, csrf_exempt(post_form_view), (), {})
     self.assertEqual(None, req2)