This commit is contained in:
Iliyan Angelov
2025-09-14 23:24:25 +03:00
commit c67067a2a4
71311 changed files with 6800714 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
from contextlib import contextmanager
from unittest.mock import patch
import pytest
from allauth.mfa import recovery_codes, totp
@pytest.fixture
def user_with_totp(user):
totp.TOTP.activate(user, totp.generate_totp_secret())
return user
@pytest.fixture
def user_with_recovery_codes(user):
recovery_codes.RecoveryCodes.activate(user)
return user
@pytest.fixture
def totp_validation_bypass():
@contextmanager
def f():
with patch("allauth.mfa.totp.validate_totp_code") as m:
m.return_value = True
yield
return f