コード例 #1
0
    def test_post_without_next_arg(self):
        factory = RequestFactory()
        request = factory.post('/test', data={'test': 'data'})
        response = csrf_failure(request, '')

        self.assertEqual(response.status_code, 302)
        self.assertEqual(response.url, '/')
コード例 #2
0
 def test_get(self):
     factory = RequestFactory()
     request = factory.get('/')
     response = csrf_failure(request, '')
     self.assertEqual(response.status_code, 403)