Well, looks like I've found workaround. At first we should test if a view
have CSRF protection:
def test_csrf_protected(self):
request = RequestFactory().post('', data={})
response = views.register_form(request)
self.assertEqual(response.status_code, 403)
(fix me, it is v
I need using RequestFactory instead of Client to test one of my views. So
the question is how to generate proper CSRF token to provide it to my
@csrf_protect'ed view? At this moment I get 403 error when generating POST
request.
I've read similar topic in this group dated 2011 year, but that top
2 matches
Mail list logo