Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
madjid-asa committed Feb 14, 2024
1 parent 289f09f commit 39a37fc
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions lemarche/tenders/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,15 +663,17 @@ def setUpTestData(cls):
# coords=Point(5.7301, 45.1825),
)
# partners
PartnerShareTenderFactory(perimeters=[])
PartnerShareTenderFactory(perimeters=[cls.auvergne_rhone_alpes_perimeter])
PartnerShareTenderFactory(perimeters=[cls.isere_perimeter])
PartnerShareTenderFactory(perimeters=[cls.grenoble_perimeter])
PartnerShareTenderFactory(perimeters=[], amount_in=tender_constants.AMOUNT_RANGE_0_1)
PartnerShareTenderFactory(perimeters=[], amount_in=tender_constants.AMOUNT_RANGE_10_15)
PartnerShareTenderFactory(perimeters=[], amount_in=tender_constants.AMOUNT_RANGE_100_150)
PartnerShareTenderFactory(perimeters=[], is_active=True)
PartnerShareTenderFactory(perimeters=[cls.auvergne_rhone_alpes_perimeter], is_active=True)
PartnerShareTenderFactory(perimeters=[cls.isere_perimeter], is_active=True)
PartnerShareTenderFactory(perimeters=[cls.grenoble_perimeter], is_active=True)
PartnerShareTenderFactory(perimeters=[], amount_in=tender_constants.AMOUNT_RANGE_0_1, is_active=True)
PartnerShareTenderFactory(perimeters=[], amount_in=tender_constants.AMOUNT_RANGE_10_15, is_active=True)
PartnerShareTenderFactory(perimeters=[], amount_in=tender_constants.AMOUNT_RANGE_100_150, is_active=True)
PartnerShareTenderFactory(
perimeters=[cls.isere_perimeter, cls.rhone_perimeter], amount_in=tender_constants.AMOUNT_RANGE_10_15
perimeters=[cls.isere_perimeter, cls.rhone_perimeter],
amount_in=tender_constants.AMOUNT_RANGE_10_15,
is_active=True,
)

def test_tender_country_matching(self):
Expand Down Expand Up @@ -724,6 +726,20 @@ def test_tender_perimeters_and_amount_matching(self):
result = PartnerShareTender.objects.filter_by_tender(tender_3)
self.assertEqual(len(result), 3 + 3)

def test_tender_partner_is_active(self):
# partners with perimeters=[]
tender = TenderFactory(is_country_area=True)
# by default is_active is False
partner = PartnerShareTenderFactory(perimeters=[])
result = PartnerShareTender.objects.filter_by_tender(tender)
self.assertEqual(len(result), 4)
# update partner
partner.is_active = True
partner.save()
# we should have +1 partner
result_2 = PartnerShareTender.objects.filter_by_tender(tender)
self.assertEqual(len(result_2), 4 + 1)


class TenderSiaeModelQuerysetTest(TestCase):
@classmethod
Expand Down

0 comments on commit 39a37fc

Please sign in to comment.