(user_id=None, lifetime=LIFETIME)
| 77 | @pytest.fixture |
| 78 | def token(jwt_strategy: JWTStrategy[UserModel, IDType]): |
| 79 | def _token(user_id=None, lifetime=LIFETIME): |
| 80 | data = {"aud": "fastapi-users:auth"} |
| 81 | if user_id is not None: |
| 82 | data["sub"] = str(user_id) |
| 83 | return generate_jwt( |
| 84 | data, jwt_strategy.encode_key, lifetime, algorithm=jwt_strategy.algorithm |
| 85 | ) |
| 86 | |
| 87 | return _token |
| 88 |
nothing calls this directly
no test coverage detected