Skip to content

Commit

Permalink
✅ [#8] Test real TOTP token login flow
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Feb 1, 2024
1 parent caa4ed8 commit 0b4a324
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ def user(db: None, django_user_model):
# the lookup is by username, so we can assume so as well.
user = UserModel._default_manager.get_by_natural_key(username)
except UserModel.DoesNotExist:
user_data = {"email": "[email protected]"}
user_data["password"] = "password"
user_data["username"] = username
user_data = {
"email": "[email protected]",
"password": "password",
"username": username,
"is_staff": True,
}
user = UserModel._default_manager.create_user(**user_data)
return user

Expand Down
3 changes: 3 additions & 0 deletions tests/test_admin_login_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ def test_totp_device(settings, totp_device, client: Client):
)
assertRedirects(token_response, admin_index_url, fetch_redirect_response=False)

admin_index = client.get(admin_index_url)
assert admin_index.status_code == 200


def test_non_verified_user_is_logged_out(settings, totp_device, client: Client):
"""
Expand Down

0 comments on commit 0b4a324

Please sign in to comment.