Skip to content

Commit

Permalink
remove closed verbatim in tests because local is not supported in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
madjid-asa committed Feb 21, 2024
1 parent f7a4bd3 commit 8b65e16
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions lemarche/www/tenders/tests.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import locale
from datetime import timedelta
from unittest import mock

Expand Down Expand Up @@ -681,12 +680,6 @@ def setUpTestData(cls):
detail_display_date=timezone.now(),
detail_not_interested_click_date=timezone.now(),
)
# set local in french for datetime human dispaly
locale.setlocale(locale.LC_TIME, "fr_FR")

@classmethod
def get_closed_verbatim(cls, tender: Tender):
return f"{tender.get_kind_display()} clôturé le {tender.deadline_date.strftime('%d %B %Y')}"

def test_anyone_can_view_sent_tenders(self):
for tender in Tender.objects.all():
Expand Down Expand Up @@ -813,17 +806,6 @@ def test_tender_amount_display(self):
self.assertContains(response, "Montant du marché")
self.assertContains(response, tender_constants.ACCEPT_SHARE_AMOUNT_FALSE)

def test_tender_deadline_date_display(self):
# tender is not outdated by default
url = reverse("tenders:detail", kwargs={"slug": self.tender_1.slug})
response = self.client.get(url)
self.assertNotContains(response, self.get_closed_verbatim(tender=self.tender_1))
# new tender with outdated deadline_date
tender_2 = TenderFactory(deadline_date=timezone.now() - timedelta(days=1))
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, self.get_closed_verbatim(tender=tender_2))

def test_tender_author_has_additional_stats(self):
self.client.force_login(self.user_buyer_1)
url = reverse("tenders:detail", kwargs={"slug": self.tender_1.slug})
Expand Down Expand Up @@ -856,7 +838,6 @@ def test_tender_contact_display(self):
# anonymous user
url = reverse("tenders:detail", kwargs={"slug": self.tender_1.slug})
response = self.client.get(url)
self.assertNotContains(response, self.get_closed_verbatim(tender=self.tender_1))
self.assertContains(response, "Cet appel d'offres vous intéresse ?")
self.assertContains(response, "Répondre en co-traitance ?")
self.assertContains(response, "Cette demande ne vous intéresse pas ?")
Expand Down Expand Up @@ -915,7 +896,6 @@ def test_tender_response_is_anonymous_contact_display(self):
# anonymous user
url = reverse("tenders:detail", kwargs={"slug": self.tender_3_response_is_anonymous.slug})
response = self.client.get(url)
self.assertNotContains(response, self.get_closed_verbatim(tender=self.tender_3_response_is_anonymous))
self.assertContains(response, "Cet appel d'offres vous intéresse ?")
self.assertContains(response, "Répondre en co-traitance ?")
self.assertContains(response, "Cette demande ne vous intéresse pas ?")
Expand Down Expand Up @@ -977,33 +957,28 @@ def test_tender_outdated_contact_display(self):
# anonymous user
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, self.get_closed_verbatim(tender=tender_2))
self.assertNotContains(response, "Répondre à cette opportunité")
# siae user interested
self.client.force_login(self.siae_user_1)
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, self.get_closed_verbatim(tender=tender_2))
self.assertNotContains(response, "Contactez le client dès maintenant")
self.assertNotContains(response, "Répondre à cette opportunité")
# siae user not concerned
self.client.force_login(self.siae_user_6)
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, self.get_closed_verbatim(tender=tender_2))
self.assertNotContains(response, "Répondre à cette opportunité")
# siae user without siae
self.client.force_login(self.siae_user_without_siae)
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, self.get_closed_verbatim(tender=tender_2))
self.assertNotContains(response, "veuillez d'abord vous")
self.assertNotContains(response, "Répondre à cette opportunité")
# author
self.client.force_login(self.user_buyer_1)
url = reverse("tenders:detail", kwargs={"slug": tender_2.slug})
response = self.client.get(url)
self.assertContains(response, self.get_closed_verbatim(tender=tender_2))
self.assertContains(response, "Coordonnées")
self.assertNotContains(response, "Contactez le client dès maintenant")
self.assertNotContains(response, "Répondre à cette opportunité")
Expand Down

0 comments on commit 8b65e16

Please sign in to comment.