API - active user if not when adding admin rigths

This commit is contained in:
Sam 2022-03-20 16:31:48 +01:00
parent 612549ddea
commit c92787a0d5
2 changed files with 11 additions and 0 deletions

View File

@ -36,6 +36,15 @@ class TestSetAdminRights:
assert user_1_admin.admin is True
def test_it_activates_account_if_user_is_inactive(
self, app: Flask, inactive_user: User
) -> None:
set_admin_rights(inactive_user.username)
assert inactive_user.admin is True
assert inactive_user.is_active is True
assert inactive_user.confirmation_token is None
class TestIsValidEmail:
@pytest.mark.parametrize(

View File

@ -9,4 +9,6 @@ def set_admin_rights(username: str) -> None:
if not user:
raise UserNotFoundException()
user.admin = True
user.is_active = True
user.confirmation_token = None
db.session.commit()