Skip to content

Commit

Permalink
test: Fix a test that didn't run correctly.
Browse files Browse the repository at this point in the history
This test was missing an assert to ensure that authentication succeeded.
However when we add the assert, I learned that the test was failing
because the Authorization header was not being submitted correctly into
the initial request.  I updated the test so that it would pass as
expected.
  • Loading branch information
feanil committed Jul 21, 2023
1 parent ddfef50 commit 88f7879
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ def test_authenticate_with_correct_jwt_authorization(self):
Note: CSRF protection should be skipped for this case, with no PermissionDenied.
"""
jwt_token = self._get_test_jwt_token()
request = RequestFactory().get('/', HTTP_AUTHORIZATION=jwt_token)
JwtAuthentication().authenticate(request)
request = RequestFactory().get('/', HTTP_AUTHORIZATION=f"JWT {jwt_token}")
assert JwtAuthentication().authenticate(request)

def test_authenticate_with_incorrect_jwt_authorization(self):
""" With JWT header it continues and validates the credentials and throws error. """
Expand Down

0 comments on commit 88f7879

Please sign in to comment.