Skip to content

Commit ab1ab49

Browse files
committed
fixes tests
1 parent af632ac commit ab1ab49

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

supertokens_python/recipe/session/jwks.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ def get_cached_keys() -> Optional[List[PyJWK]]:
6666
# if it has a valid cache entry from one of the core URLs. It will only attempt to fetch
6767
# from the cores again after the entry in the cache is expired
6868
if cached_keys.is_fresh():
69-
if environ.get("SUPERTOKENS_ENV") == "testing":
70-
log_debug_message("Returning JWKS from cache")
7169
return cached_keys.keys
7270

7371
return None
@@ -97,6 +95,8 @@ def get_latest_keys(kid: Optional[str] = None) -> List[PyJWK]:
9795
with RWLockContext(mutex, read=True):
9896
matching_keys = find_matching_keys(get_cached_keys(), kid)
9997
if matching_keys is not None:
98+
if environ.get("SUPERTOKENS_ENV") == "testing":
99+
log_debug_message("Returning JWKS from cache")
100100
return matching_keys
101101
# otherwise unknown kid, will continue to reload the keys
102102

tests/sessions/test_jwks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
get_latest_keys,
3232
)
3333
from supertokens_python.utils import utf_base64encode
34+
from tests.utils import min_api_version
3435

3536
from _pytest.logging import LogCaptureFixture
3637

@@ -491,6 +492,7 @@ async def test_session_verification_of_jwt_based_on_session_payload(
491492
assert s_.get_user_id() == "userId"
492493

493494

495+
@min_api_version("3.0")
494496
async def test_session_verification_of_jwt_based_on_session_payload_with_check_db():
495497
init(**get_st_init_args(recipe_list=[session.init()]))
496498
start_st()
@@ -500,7 +502,6 @@ async def test_session_verification_of_jwt_based_on_session_payload_with_check_d
500502
payload = s.get_access_token_payload()
501503
del payload["iat"]
502504
del payload["exp"]
503-
payload["tId"] = "public" # tenant id
504505

505506
now = get_timestamp_ms()
506507
jwt_expiry = now + 10 * 1000 # expiry jwt after 10sec

tests/utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ async def get_api_version():
468468

469469
api_version = asyncio.gather(get_api_version())
470470
core_version = loop.run_until_complete(api_version)[0] # type: ignore # pylint: disable=unused-variable
471+
teardown_function(_)
471472
return core_version
472473

473474

0 commit comments

Comments
 (0)