diff --git a/bda/tests/test_views.py b/bda/tests/test_views.py index 3ee46792..b0846fd7 100644 --- a/bda/tests/test_views.py +++ b/bda/tests/test_views.py @@ -50,10 +50,12 @@ class BdATestHelpers: ] def require_custommails(self): - from gestioncof.management.commands import syncmails - syncmails.load_from_file() + from django.core.management import call_command + call_command("syncmails") - def check_restricted_access(self, url, validate_user=user_is_cof, redirect_url=None): + def check_restricted_access(self, url, + validate_user=user_is_cof, + redirect_url=None): def craft_redirect_url(user): if redirect_url: return redirect_url @@ -73,14 +75,14 @@ class BdATestHelpers: class TestBdAViews(BdATestHelpers, TestCase): def setUp(self): - # Signals handlers on login/logout send messages. + # Signals handlers on login/logout send messages. # Due to the way the Django' test Client performs login, this raise an # error. As workaround, we mock the Django' messages module. patcher_messages = mock.patch('gestioncof.signals.messages') patcher_messages.start() self.addCleanup(patcher_messages.stop) # Set up the helpers - BdATestHelpers.setUp(self) + super().setUp() # Some BdA stuff self.tirage = Tirage.objects.create( title="Test tirage",