Skip to content

Commit

Permalink
fix(EmailGroupFactory): flush EmailGroup manualy before to prevent du…
Browse files Browse the repository at this point in the history
…plicate key errors
  • Loading branch information
SebastienReuiller committed Dec 16, 2024
1 parent 83b5141 commit 27d5904
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lemarche/conversations/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ def test_get_template_id(self):


class TemplateTransactionalModelSaveTest(TransactionTestCase):
reset_sequences = True

@classmethod
def setUpTestData(cls):
pass
Expand Down
2 changes: 2 additions & 0 deletions lemarche/www/dashboard_siaes/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from django.urls import reverse

from lemarche.conversations.factories import TemplateTransactionalFactory
from lemarche.conversations.models import EmailGroup
from lemarche.perimeters.factories import PerimeterFactory
from lemarche.perimeters.models import Perimeter
from lemarche.sectors.factories import SectorFactory, SectorGroupFactory
Expand All @@ -23,6 +24,7 @@ def setUpTestData(cls):
cls.siae_with_user = SiaeFactory()
cls.siae_with_user.users.add(cls.user_siae)
cls.siae_without_user = SiaeFactory()
EmailGroup.objects.all().delete() # to avoid duplicate key error
TemplateTransactionalFactory(code="SIAEUSERREQUEST_ASSIGNEE")

def test_anonymous_user_cannot_adopt_siae(self):
Expand Down
2 changes: 2 additions & 0 deletions lemarche/www/tenders/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from sesame.utils import get_query_string as sesame_get_query_string

from lemarche.conversations.factories import TemplateTransactionalFactory
from lemarche.conversations.models import EmailGroup
from lemarche.perimeters.factories import PerimeterFactory
from lemarche.perimeters.models import Perimeter
from lemarche.sectors.factories import SectorFactory
Expand Down Expand Up @@ -1133,6 +1134,7 @@ def setUpTestData(cls):
cls.tender_contact_click_stat_url = reverse(
"tenders:detail-contact-click-stat", kwargs={"slug": cls.tender.slug}
)
EmailGroup.objects.all().delete() # to avoid duplicate key error
TemplateTransactionalFactory(code="TENDERS_AUTHOR_SIAE_INTERESTED_1")

def test_anonymous_user_cannot_notify_interested(self):
Expand Down

0 comments on commit 27d5904

Please sign in to comment.