API - active user if not when adding admin rigths
This commit is contained in:
parent
612549ddea
commit
c92787a0d5
@ -36,6 +36,15 @@ class TestSetAdminRights:
|
|||||||
|
|
||||||
assert user_1_admin.admin is True
|
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:
|
class TestIsValidEmail:
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
|
@ -9,4 +9,6 @@ def set_admin_rights(username: str) -> None:
|
|||||||
if not user:
|
if not user:
|
||||||
raise UserNotFoundException()
|
raise UserNotFoundException()
|
||||||
user.admin = True
|
user.admin = True
|
||||||
|
user.is_active = True
|
||||||
|
user.confirmation_token = None
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
Loading…
Reference in New Issue
Block a user