Skip to content

Commit 62414bf

Browse files
Merge pull request #444 from supertokens/fix/failing-test
fix: Failing unit tests
2 parents 6620ea5 + a82a191 commit 62414bf

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

supertokens_python/recipe/session/session_class.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ async def assert_claims(
207207
for k in protected_props:
208208
try:
209209
del validate_claim_res.access_token_payload_update[k]
210-
except ValueError:
210+
except KeyError:
211211
pass
212212
await self.merge_into_access_token_payload(
213213
validate_claim_res.access_token_payload_update, user_context

tests/sessions/claims/test_assert_claims.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
)
1717
from supertokens_python.recipe.session.session_class import Session
1818
from supertokens_python import init
19-
from tests.utils import setup_function, teardown_function, start_st, st_init_common_args
19+
from tests.utils import get_st_init_args, setup_function, teardown_function, start_st, st_init_common_args
20+
from supertokens_python.recipe.session.asyncio import create_new_session_without_request_response
21+
from .utils import TrueClaim
2022

2123
_ = setup_function # type:ignore
2224
_ = teardown_function # type:ignore
@@ -125,3 +127,12 @@ def should_refetch(self, payload: JSONObject, user_context: Dict[str, Any]):
125127

126128
assert dummy_claim_validator.validate_calls == {json.dumps(payload): 1}
127129
mock.assert_not_called()
130+
131+
132+
async def test_assert_claims_should_work():
133+
init(**get_st_init_args([session.init()]))
134+
start_st()
135+
136+
validator = TrueClaim.validators.is_true(1)
137+
s = await create_new_session_without_request_response("public", "userid", {})
138+
await s.assert_claims([validator])

0 commit comments

Comments
 (0)