API - add tests on JWT generation

This commit is contained in:
Sam
2022-08-03 20:38:26 +02:00
parent 8dc7761c48
commit 98a3e3fec1
2 changed files with 182 additions and 3 deletions

View File

@ -21,10 +21,11 @@ def get_user_token(
if password_reset
else current_app.config['TOKEN_EXPIRATION_SECONDS']
)
now = datetime.utcnow()
payload = {
'exp': datetime.utcnow()
'exp': now
+ timedelta(days=expiration_days, seconds=expiration_seconds),
'iat': datetime.utcnow(),
'iat': now,
'sub': user_id,
}
return jwt.encode(