Sorry for the esoteric question, but I am a complete Django beginner so experts reading this should be able to handle esoteric questions from beginners.
First you want to navigate to the line I’m talking about. It’s in this section, down in the third code block, second test method definition, where the last line says:
self.assertEqual(response.status_code, 403)
The method, as you can tell by it’s name, “test_redirect_if_logged_in_but_not_correct_permission,” is supposed to test for a redirect. However, as the line above shows, we actually tested for a 403 Forbidden error. That’s not a redirect.
So obviously my console gave me this when I ran my tests:
FAIL: test_redirect_if_logged_in_but_not_correct_permission (catalog.tests.test_views.RenewBookInstancesViewTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/romanmirov/dev/django_projects/locallibrary/catalog/tests/test_views.py", line 248, in test_redirect_if_logged_in_but_not_correct_permission
self.assertEqual(response.status_code, 403)
AssertionError: 302 != 403
Again, when you try loading the renew book form as a non-librarian, you should be redirected to the sign in page to sign in as a librarian, as that’s what the previous tutorials had us implement and it looks like that was the intended purpose of the method.
So is the 403 a typo or what? Is it supposed to be 302?