From a73661ced2801e0fbca538d9f51fb809568003ac Mon Sep 17 00:00:00 2001 From: Daniil <94884910+Filienko@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:58:06 -0700 Subject: [PATCH] Specify api test header --- tests/test_api.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index 587e6e9..af0f396 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -66,17 +66,17 @@ def test_validate_jwt(self, mock_decode, mock_jwk_client): self.assertEqual(response.status_code, 200) # Test valid token - response = self.client.get('/', headers={'Authorization': 'Bearer valid_token'}) + response = self.client.get('/', headers={'Authorization': 'Bearer valid_token', 'Content-Type': 'application/json'}) self.assertEqual(response.status_code, 200) # Test missing token - response = self.client.get('/') + response = self.client.get('/', headers={'Content-Type': 'application/json'}) self.assertEqual(response.status_code, 400) self.assertEqual(response.json['message'], "token missing") # Test expired token mock_decode.side_effect = jwt.exceptions.ExpiredSignatureError() - response = self.client.get('/', headers={'Authorization': 'Bearer expired_token'}) + response = self.client.get('/', headers={'Authorization': 'Bearer expired_token', 'Content-Type': 'application/json'}) self.assertEqual(response.status_code, 401) self.assertEqual(response.json['message'], "token expired")