From 0dc905671de2537a27d4b305657d1443cf9a1995 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Thu, 28 Sep 2023 08:55:23 +0200 Subject: [PATCH] =?UTF-8?q?[D=C3=A9p=C3=B4t=20de=20besoin]=20Sondage=20J+3?= =?UTF-8?q?0=20:=20mettre=20=C3=A0=20jour=20siae=5Ftransactioned=20(#922)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Survey transactioned: also update siae_transactioned field * Update tests --- lemarche/www/tenders/tests.py | 8 ++++++++ lemarche/www/tenders/views.py | 1 + 2 files changed, 9 insertions(+) diff --git a/lemarche/www/tenders/tests.py b/lemarche/www/tenders/tests.py index 922c2dded..02a8e2694 100644 --- a/lemarche/www/tenders/tests.py +++ b/lemarche/www/tenders/tests.py @@ -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}) @@ -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}) @@ -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}) @@ -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).siae_transactioned, 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}) @@ -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}) @@ -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}) @@ -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) diff --git a/lemarche/www/tenders/views.py b/lemarche/www/tenders/views.py index f3daa8edc..8daf4af21 100644 --- a/lemarche/www/tenders/views.py +++ b/lemarche/www/tenders/views.py @@ -522,6 +522,7 @@ def get(self, request, *args, **kwargs): Tender.objects.filter(id=self.object.id).update( survey_transactioned_answer=survey_transactioned_answer, survey_transactioned_answer_date=timezone.now(), + siae_transactioned=survey_transactioned_answer, updated_at=timezone.now(), ) messages.add_message(