From 7c19d1357ebe93dd44c8836b509080b9126b28fe Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Mon, 15 Jan 2024 12:37:45 +0100 Subject: [PATCH] Add test --- lemarche/tenders/tests.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lemarche/tenders/tests.py b/lemarche/tenders/tests.py index 54eecf1bc..e4ea998f2 100644 --- a/lemarche/tenders/tests.py +++ b/lemarche/tenders/tests.py @@ -290,6 +290,7 @@ def setUpTestData(cls): siae_with_tender_5 = SiaeFactory() siae_with_tender_6 = SiaeFactory() siae_with_tender_7 = SiaeFactory() + siae_with_tender_8 = SiaeFactory() cls.siae_without_tender = SiaeFactory() cls.tender_with_siae_1 = TenderFactory( siaes=[cls.siae_with_tender_1, siae_with_tender_2], deadline_date=date_tomorrow @@ -323,8 +324,16 @@ def setUpTestData(cls): siae=siae_with_tender_7, email_send_date=timezone.now(), email_link_click_date=timezone.now(), + detail_display_date=timezone.now(), detail_cocontracting_click_date=timezone.now(), ) + TenderSiae.objects.create( + tender=cls.tender_with_siae_1, + siae=siae_with_tender_8, + email_send_date=timezone.now(), + email_link_click_date=timezone.now(), + detail_not_interested_click_date=timezone.now(), + ) cls.tender_with_siae_2 = TenderFactory() TenderSiae.objects.create( tender=cls.tender_with_siae_2, @@ -347,14 +356,15 @@ def test_filter_with_siaes(self): def test_with_siae_stats(self): self.assertEqual(Tender.objects.count(), 2 + 1) tender_with_siae_1 = Tender.objects.with_siae_stats().filter(id=self.tender_with_siae_1.id).first() - self.assertEqual(tender_with_siae_1.siaes.count(), 7) - self.assertEqual(tender_with_siae_1.siae_count_annotated, 7) - self.assertEqual(tender_with_siae_1.siae_email_send_count_annotated, 5) - self.assertEqual(tender_with_siae_1.siae_email_link_click_count_annotated, 4) - self.assertEqual(tender_with_siae_1.siae_detail_display_count_annotated, 2) - self.assertEqual(tender_with_siae_1.siae_email_link_click_or_detail_display_count_annotated, 2) + self.assertEqual(tender_with_siae_1.siaes.count(), 8) + self.assertEqual(tender_with_siae_1.siae_count_annotated, 8) + self.assertEqual(tender_with_siae_1.siae_email_send_count_annotated, 6) + self.assertEqual(tender_with_siae_1.siae_email_link_click_count_annotated, 5) + self.assertEqual(tender_with_siae_1.siae_detail_display_count_annotated, 4) + self.assertEqual(tender_with_siae_1.siae_email_link_click_or_detail_display_count_annotated, 4) self.assertEqual(tender_with_siae_1.siae_detail_contact_click_count_annotated, 1) self.assertEqual(tender_with_siae_1.siae_detail_cocontracting_click_count_annotated, 1) + self.assertEqual(tender_with_siae_1.siae_detail_not_interested_click_count_annotated, 1) self.assertEqual(tender_with_siae_1.siae_detail_contact_click_since_last_seen_date_count_annotated, 1) tender_with_siae_2 = Tender.objects.with_siae_stats().filter(id=self.tender_with_siae_2.id).first() self.assertEqual(tender_with_siae_2.siaes.count(), 1)