Beispiel #1
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 = CsrfMiddleware().process_view(req, csrf_exempt(post_form_view), (), {})
     self.assertEquals(None, req2)
Beispiel #2
0
 def test_process_response_exempt_view(self):
     """
     Check that no post processing is done for an exempt view
     """
     req = self._get_POST_csrf_cookie_request()
     resp = csrf_exempt(post_form_view)(req)
     resp_content = resp.content
     resp2 = CsrfMiddleware().process_response(req, resp)
     self.assertEquals(resp_content, resp2.content)