From 05c1242c92e05d0164f17b9ee2e9af9fdad79944 Mon Sep 17 00:00:00 2001 From: rishabhpoddar Date: Wed, 25 Sep 2024 20:50:34 +0530 Subject: [PATCH] fixes more tests --- tests/emailpassword/test_emailverify.py | 12 ++++++------ tests/sessions/claims/test_primitive_array_claim.py | 4 ++-- tests/sessions/claims/test_set_claim_value.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/emailpassword/test_emailverify.py b/tests/emailpassword/test_emailverify.py index a87ed908..06314917 100644 --- a/tests/emailpassword/test_emailverify.py +++ b/tests/emailpassword/test_emailverify.py @@ -1126,7 +1126,7 @@ async def test_the_generate_token_api_with_valid_input_and_then_remove_token( verify_token = await create_email_verification_token( "public", RecipeUserId(user_id) ) - await revoke_email_verification_tokens("public", user_id) + await revoke_email_verification_tokens("public", RecipeUserId(user_id)) if isinstance(verify_token, CreateEmailVerificationTokenOkResult): response = await verify_email_using_token("public", verify_token.token) @@ -1175,11 +1175,11 @@ async def test_the_generate_token_api_with_valid_input_verify_and_then_unverify_ if isinstance(verify_token, CreateEmailVerificationTokenOkResult): await verify_email_using_token("public", verify_token.token) - assert await is_email_verified(user_id) + assert await is_email_verified(RecipeUserId(user_id)) - await unverify_email(user_id) + await unverify_email(RecipeUserId(user_id)) - is_verified = await is_email_verified(user_id) + is_verified = await is_email_verified(RecipeUserId(user_id)) assert is_verified is False return raise Exception("Test failed") @@ -1304,10 +1304,10 @@ async def send_email( ) assert res.status_code == 200 assert res.json() == {"status": "EMAIL_ALREADY_VERIFIED_ERROR"} - assert "front-token" not in res.headers + assert res.headers.get("front-token") is not None # now we mark the email as unverified and try again: - await unverify_email(user_id) + await unverify_email(RecipeUserId(user_id)) res = email_verify_token_request( driver_config_client, cookies["sAccessToken"]["value"], diff --git a/tests/sessions/claims/test_primitive_array_claim.py b/tests/sessions/claims/test_primitive_array_claim.py index 939ef9c7..35c930d9 100644 --- a/tests/sessions/claims/test_primitive_array_claim.py +++ b/tests/sessions/claims/test_primitive_array_claim.py @@ -426,13 +426,13 @@ async def test_validator_excludes_all_should_validate_matching_payload(): async def test_validator_should_not_validate_older_values_with_5min_default_max_age( patch_get_timestamp_ms: MagicMock, ): - claim = PrimitiveArrayClaim("key", sync_fetch_value, 3000) # 5 mins + claim = PrimitiveArrayClaim("key", sync_fetch_value, 300) # 5 mins payload = await claim.build( "user_id", RecipeUserId("user_id"), DEFAULT_TENANT_ID, {} ) # Increase clock time by 10 MINS: - patch_get_timestamp_ms.return_value += 10 * MINS # type: ignore + patch_get_timestamp_ms.return_value += 10 * MINS res = await resolve(claim.validators.includes(included_item).validate(payload, {})) assert res.is_valid is False diff --git a/tests/sessions/claims/test_set_claim_value.py b/tests/sessions/claims/test_set_claim_value.py index 35d56c65..a1067769 100644 --- a/tests/sessions/claims/test_set_claim_value.py +++ b/tests/sessions/claims/test_set_claim_value.py @@ -69,7 +69,7 @@ async def test_should_overwrite_claim_value(timestamp: int): # Payload should be updated now: payload = s.get_access_token_payload() - assert len(payload) == 10 + assert len(payload) == 11 assert payload["st-true"] == {"t": timestamp, "v": False}