From c213eef69403c3762f88bb172c9996d68935064f Mon Sep 17 00:00:00 2001
From: Bryan Brancotte <bryan.brancotte@pasteur.fr>
Date: Mon, 5 Oct 2020 16:45:39 +0200
Subject: [PATCH] fixe test for django 3.1

---
 basetheme_bootstrap/tests.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/basetheme_bootstrap/tests.py b/basetheme_bootstrap/tests.py
index ba8fb89..c2f9bea 100644
--- a/basetheme_bootstrap/tests.py
+++ b/basetheme_bootstrap/tests.py
@@ -143,6 +143,7 @@ class SignUpWithFirstLastNameRequiredTests(TestCase):
 @override_settings(
     BASETHEME_BOOTSTRAP_VALIDATE_EMAIL_BEFORE_ACTIVATION=True,
     PASSWORD_RESET_TIMEOUT_DAYS=1,
+    PASSWORD_RESET_TIMEOUT=60*60*24,
 )
 class SignUpWithValidationTests(TestCase):
 
@@ -200,7 +201,6 @@ class SignUpWithValidationTests(TestCase):
         self.assertEqual(len(m), 1)
 
     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
 
         class MockedTokenGenerator(tokens.TokenGenerator):
@@ -209,6 +209,11 @@ class SignUpWithValidationTests(TestCase):
                 # Used for mocking in tests
                 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()
 
         user_count = get_user_model().objects.count()
-- 
GitLab