Issue
I know there are few same posts with this problem, but they doesn't helped for me. I'm always got a 301 status in tests:
self.client.get('/')
and this:
self.client.get('/admin/')
return:
AssertionError: 301 != 200
All urls will returning 301 status... Only way that help is: self.client.get('/', follow=True)
Anybody knows where is problem?
Solution
301 is status for redirection, whitch means your get request first have response that is the 301. Http headers contains the url to redirect to...
If you want your request to follow, you have pass in follow=True, which indicates the method to automatically trigger another request to the redirect url. There can be many redirections.
It's a common error in assertion tests.
Answered By - biodigitals
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.