MCPcopy Index your code
hub / github.com/fastapi-users/fastapi-users / test_write_token

Function test_write_token

tests/test_authentication_strategy_jwt.py:142–151  ·  view source on GitHub ↗
(jwt_strategy: JWTStrategy[UserModel, IDType], user)

Source from the content-addressed store, hash-verified

140@pytest.mark.authentication
141@pytest.mark.asyncio
142async def test_write_token(jwt_strategy: JWTStrategy[UserModel, IDType], user):
143 token = await jwt_strategy.write_token(user)
144
145 decoded = decode_jwt(
146 token,
147 jwt_strategy.decode_key,
148 audience=jwt_strategy.token_audience,
149 algorithms=[jwt_strategy.algorithm],
150 )
151 assert decoded["sub"] == str(user.id)
152
153
154@pytest.mark.parametrize("jwt_strategy", ["HS256", "RS256", "ES256"], indirect=True)

Callers

nothing calls this directly

Calls 2

decode_jwtFunction · 0.90
write_tokenMethod · 0.45

Tested by

no test coverage detected