From e843bbf35603ee83563eabfbf4b8d7263b7724bf Mon Sep 17 00:00:00 2001 From: Daniel McKnight Date: Thu, 21 Nov 2024 17:54:00 -0800 Subject: [PATCH] Fix invalid references in unit tests Replace validation that auth and refresh tokens match --- neon_hana/auth/client_manager.py | 6 +++--- tests/test_auth.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/neon_hana/auth/client_manager.py b/neon_hana/auth/client_manager.py index 77c84f3..7a5f7b1 100644 --- a/neon_hana/auth/client_manager.py +++ b/neon_hana/auth/client_manager.py @@ -272,9 +272,9 @@ def check_refresh_request(self, access_token: Optional[str], except ExpiredSignatureError: raise HTTPException(status_code=401, detail="Refresh token is expired") - # if refresh_data.jti != token_data.jti + ".refresh": - # raise HTTPException(status_code=403, - # detail="Refresh and access token mismatch") + if refresh_data.jti != token_data.jti + ".refresh": + raise HTTPException(status_code=403, + detail="Refresh and access token mismatch") if time() > refresh_data.exp: raise HTTPException(status_code=401, detail="Refresh token is expired") diff --git a/tests/test_auth.py b/tests/test_auth.py index c6e5139..b5270d1 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -127,8 +127,8 @@ def test_check_refresh_request(self): # Test valid refresh valid_refresh = self.client_manager.check_refresh_request( - access, refresh, config.client_id) - self.assertEqual(valid_refresh.client_id, config.client_id) + access, refresh, config['access'].client_id) + self.assertEqual(valid_refresh.client_id, config['access'].client_id) self.assertNotEqual(valid_refresh.access_token, access) self.assertNotEqual(valid_refresh.refresh_token, refresh)