Add event delete tests

This commit is contained in:
Sebastiaan
2025-06-09 16:21:52 +02:00
parent fb0135cf38
commit bf3fa03db0
3 changed files with 68 additions and 4 deletions

View File

@@ -46,3 +46,20 @@ def authentication_token_from_email(
user = User.update(session=db, db_obj=user, in_obj=user_in_update)
return user_authentication_headers(client=client, email=email, password=password)
def authentication_token_from_user(
*, client: TestClient, user: User, db: Session
) -> dict[str, str]:
"""
Return a valid token for the user with given email.
If the user doesn't exist it is created first.
"""
password = random_lower_string()
user_in_update = UserUpdate(password=password)
if not user.id:
raise Exception("User id not set")
user = User.update(session=db, db_obj=user, in_obj=user_in_update)
return user_authentication_headers(client=client, email=str(user.email), password=password)