forked from DGNum/gestioCOF
Minor simplificatons after code review
This commit is contained in:
parent
79fccc136a
commit
d57c75d2a0
1 changed files with 7 additions and 5 deletions
|
@ -50,10 +50,12 @@ class BdATestHelpers:
|
||||||
]
|
]
|
||||||
|
|
||||||
def require_custommails(self):
|
def require_custommails(self):
|
||||||
from gestioncof.management.commands import syncmails
|
from django.core.management import call_command
|
||||||
syncmails.load_from_file()
|
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):
|
def craft_redirect_url(user):
|
||||||
if redirect_url:
|
if redirect_url:
|
||||||
return redirect_url
|
return redirect_url
|
||||||
|
@ -73,14 +75,14 @@ class BdATestHelpers:
|
||||||
|
|
||||||
class TestBdAViews(BdATestHelpers, TestCase):
|
class TestBdAViews(BdATestHelpers, TestCase):
|
||||||
def setUp(self):
|
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
|
# Due to the way the Django' test Client performs login, this raise an
|
||||||
# error. As workaround, we mock the Django' messages module.
|
# error. As workaround, we mock the Django' messages module.
|
||||||
patcher_messages = mock.patch('gestioncof.signals.messages')
|
patcher_messages = mock.patch('gestioncof.signals.messages')
|
||||||
patcher_messages.start()
|
patcher_messages.start()
|
||||||
self.addCleanup(patcher_messages.stop)
|
self.addCleanup(patcher_messages.stop)
|
||||||
# Set up the helpers
|
# Set up the helpers
|
||||||
BdATestHelpers.setUp(self)
|
super().setUp()
|
||||||
# Some BdA stuff
|
# Some BdA stuff
|
||||||
self.tirage = Tirage.objects.create(
|
self.tirage = Tirage.objects.create(
|
||||||
title="Test tirage",
|
title="Test tirage",
|
||||||
|
|
Loading…
Reference in a new issue