Skip to content
Snippets Groups Projects
Commit c213eef6 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

fixe test for django 3.1

parent 4ef943e6
No related branches found
No related tags found
No related merge requests found
Pipeline #38951 passed
...@@ -143,6 +143,7 @@ class SignUpWithFirstLastNameRequiredTests(TestCase): ...@@ -143,6 +143,7 @@ class SignUpWithFirstLastNameRequiredTests(TestCase):
@override_settings( @override_settings(
BASETHEME_BOOTSTRAP_VALIDATE_EMAIL_BEFORE_ACTIVATION=True, BASETHEME_BOOTSTRAP_VALIDATE_EMAIL_BEFORE_ACTIVATION=True,
PASSWORD_RESET_TIMEOUT_DAYS=1, PASSWORD_RESET_TIMEOUT_DAYS=1,
PASSWORD_RESET_TIMEOUT=60*60*24,
) )
class SignUpWithValidationTests(TestCase): class SignUpWithValidationTests(TestCase):
...@@ -200,7 +201,6 @@ class SignUpWithValidationTests(TestCase): ...@@ -200,7 +201,6 @@ class SignUpWithValidationTests(TestCase):
self.assertEqual(len(m), 1) self.assertEqual(len(m), 1)
def test_activate_too_late_with_user_pending_resend_email(self): def test_activate_too_late_with_user_pending_resend_email(self):
get_user_model().objects.create(username="toto")
actual_account_activation_token = tokens.account_activation_token actual_account_activation_token = tokens.account_activation_token
class MockedTokenGenerator(tokens.TokenGenerator): class MockedTokenGenerator(tokens.TokenGenerator):
...@@ -209,6 +209,11 @@ class SignUpWithValidationTests(TestCase): ...@@ -209,6 +209,11 @@ class SignUpWithValidationTests(TestCase):
# Used for mocking in tests # Used for mocking in tests
return date.today() - timedelta(days=2) return date.today() - timedelta(days=2)
def _now(self):
from datetime import datetime, timedelta
# Used for mocking in tests
return datetime.now() - timedelta(days=2)
tokens.account_activation_token = MockedTokenGenerator() tokens.account_activation_token = MockedTokenGenerator()
user_count = get_user_model().objects.count() user_count = get_user_model().objects.count()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment