Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed disable_admin_mfa test util func name to disable_mfa #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions maykin_2fa/test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
)


def disable_admin_mfa():
def disable_mfa():
"""
Test helper to disable MFA requirements in the admin.
Test helper to disable MFA requirements.

Based on :func:`django.test.override_settings`, so you can use it as a decorator
or context manager.
Expand Down Expand Up @@ -50,3 +50,6 @@ def get_valid_totp_token(user: AbstractBaseUser) -> str:
if not isinstance(device, TOTPDevice):
raise ValueError("The user's default device is not a TOTPDevice.")
return _totp_str(device.bin_key)


disable_admin_mfa = disable_mfa
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
disable_admin_mfa = disable_mfa
disable_admin_mfa = disable_mfa
"""
Test helper to disable MFA requirements in the admin.
Note that this is the same as :func:`disable_mfa`, because the `user.is_verified`
check is added via middleware which applies to the entire project and not just
the admin. However, this alias exists because maykin-2fa deliberately scopes
itself to managing access to the admin interface. Use the name that best conveys
your intent in your test cases.
"""

Loading