Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Sep 26, 2023
1 parent 5a7b2be commit bcefa66
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lemarche/www/tenders/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1283,6 +1283,7 @@ def test_only_tender_author_with_sesame_token_can_call_tender_survey_transaction
def test_update_tender_stats_on_tender_survey_transactioned_answer_true(self):
user_sesame_query_string = sesame_get_query_string(self.user_buyer_1)
self.assertEqual(self.tender.survey_transactioned_answer, None)
self.assertEqual(self.tender.siae_transactioned, None)
# load without answer
url = (
reverse("tenders:detail-survey-transactioned", kwargs={"slug": self.tender.slug})
Expand All @@ -1292,6 +1293,7 @@ def test_update_tender_stats_on_tender_survey_transactioned_answer_true(self):
self.assertEqual(response.status_code, 200) # redirect
self.assertRedirects(response, reverse("tenders:detail", kwargs={"slug": self.tender.slug}))
self.assertEqual(Tender.objects.get(id=self.tender.id).survey_transactioned_answer, None)
self.assertEqual(Tender.objects.get(id=self.tender.id).siae_transactioned, None)
# load with answer
url = (
reverse("tenders:detail-survey-transactioned", kwargs={"slug": self.tender.slug})
Expand All @@ -1303,6 +1305,7 @@ def test_update_tender_stats_on_tender_survey_transactioned_answer_true(self):
self.assertRedirects(response, reverse("tenders:detail", kwargs={"slug": self.tender.slug}))
self.assertContains(response, "Merci pour vote réponse")
self.assertEqual(Tender.objects.get(id=self.tender.id).survey_transactioned_answer, True)
self.assertEqual(Tender.objects.get(id=self.tender.id).siae_transactioned, True)
# reload with answer, ignore changes
url = (
reverse("tenders:detail-survey-transactioned", kwargs={"slug": self.tender.slug})
Expand All @@ -1314,10 +1317,12 @@ def test_update_tender_stats_on_tender_survey_transactioned_answer_true(self):
self.assertRedirects(response, reverse("tenders:detail", kwargs={"slug": self.tender.slug}))
self.assertContains(response, "Votre réponse a déjà été prise en compte")
self.assertEqual(Tender.objects.get(id=self.tender.id).survey_transactioned_answer, True)
self.assertEqual(Tender.objects.get(id=self.tender.id).survey_transasiae_transactionedctioned_answer, True)

def test_update_tender_stats_on_tender_survey_transactioned_answer_false(self):
user_sesame_query_string = sesame_get_query_string(self.user_buyer_1)
self.assertEqual(self.tender.survey_transactioned_answer, None)
self.assertEqual(self.tender.siae_transactioned, None)
# load without answer
url = (
reverse("tenders:detail-survey-transactioned", kwargs={"slug": self.tender.slug})
Expand All @@ -1327,6 +1332,7 @@ def test_update_tender_stats_on_tender_survey_transactioned_answer_false(self):
self.assertEqual(response.status_code, 200) # redirect
self.assertRedirects(response, reverse("tenders:detail", kwargs={"slug": self.tender.slug}))
self.assertEqual(Tender.objects.get(id=self.tender.id).survey_transactioned_answer, None)
self.assertEqual(Tender.objects.get(id=self.tender.id).siae_transactioned, None)
# load with answer
url = (
reverse("tenders:detail-survey-transactioned", kwargs={"slug": self.tender.slug})
Expand All @@ -1338,6 +1344,7 @@ def test_update_tender_stats_on_tender_survey_transactioned_answer_false(self):
self.assertRedirects(response, reverse("tenders:detail", kwargs={"slug": self.tender.slug}))
self.assertContains(response, "Merci pour vote réponse")
self.assertEqual(Tender.objects.get(id=self.tender.id).survey_transactioned_answer, False)
self.assertEqual(Tender.objects.get(id=self.tender.id).siae_transactioned, False)
# reload with answer, ignore changes
url = (
reverse("tenders:detail-survey-transactioned", kwargs={"slug": self.tender.slug})
Expand All @@ -1349,3 +1356,4 @@ def test_update_tender_stats_on_tender_survey_transactioned_answer_false(self):
self.assertRedirects(response, reverse("tenders:detail", kwargs={"slug": self.tender.slug}))
self.assertContains(response, "Votre réponse a déjà été prise en compte")
self.assertEqual(Tender.objects.get(id=self.tender.id).survey_transactioned_answer, False)
self.assertEqual(Tender.objects.get(id=self.tender.id).siae_transactioned, False)

0 comments on commit bcefa66

Please sign in to comment.