def test_paid(self, _mock): self.make_premium(self.app) fix_excluded_regions([self.app.pk]) # There are no exclusions at all, because the payments fall back # to rest of the world. self.assertSetEqual(self.app.get_excluded_region_ids(), []) eq_(self.app.addonexcludedregion.count(), 0)
def test_free_special_excluded(self, _mock): for region in mkt.regions.SPECIAL_REGION_IDS: self.app.addonexcludedregion.create(region=region) fix_excluded_regions([self.app.pk]) self.assertSetEqual(self.app.get_excluded_region_ids(), mkt.regions.SPECIAL_REGION_IDS) eq_(self.app.addonexcludedregion.count(), len(mkt.regions.SPECIAL_REGION_IDS))
def test_ignore_restricted(self, _mock): """Set up exclusions and verify they still exist after the call.""" self.app.geodata.update(restricted=True) self.app.addonexcludedregion.create(region=mkt.regions.PER.id) self.app.addonexcludedregion.create(region=mkt.regions.FRA.id) fix_excluded_regions([self.app.pk]) self.assertSetEqual(self.app.get_excluded_region_ids(), [mkt.regions.PER.id, mkt.regions.FRA.id]) eq_(self.app.addonexcludedregion.count(), 2)
def test_paid(self, _mock): self.make_premium(self.app) # `make_premium` adds a price in a US region. Excluded is everything # but US and RESTOFWORLD. excluded = (set(mkt.regions.ALL_REGION_IDS) - set([mkt.regions.RESTOFWORLD.id, mkt.regions.US.id])) fix_excluded_regions([self.app.pk]) self.assertSetEqual(self.app.get_excluded_region_ids(), excluded) eq_(self.app.addonexcludedregion.count(), 0)
def test_paid_and_worldwide(self, _mock): self.make_premium(self.app) fix_excluded_regions([self.app.pk]) self.app.addonexcludedregion.create(region=mkt.regions.RESTOFWORLD.id) # All the other countries are excluded, but not the US because they # choose to exclude the rest of the world. excluded = set(mkt.regions.ALL_REGION_IDS) - set([mkt.regions.USA.id]) self.assertSetEqual(self.app.get_excluded_region_ids(), excluded) eq_(self.app.addonexcludedregion.count(), 1)
def test_ignore_restricted(self, _mock): """Set up exclusions and verify they still exist after the call.""" self.app.geodata.update(restricted=True) self.app.addonexcludedregion.create(region=mkt.regions.PE.id) self.app.addonexcludedregion.create(region=mkt.regions.FR.id) fix_excluded_regions([self.app.pk]) self.assertSetEqual(self.app.get_excluded_region_ids(), [mkt.regions.PE.id, mkt.regions.FR.id]) eq_(self.app.addonexcludedregion.count(), 2)
def test_free_iarc_excluded(self, _mock): # Set a few exclusions that shouldn't survive. self.app.addonexcludedregion.create(region=mkt.regions.PER.id) self.app.addonexcludedregion.create(region=mkt.regions.FRA.id) # Set IARC settings to influence region exclusions. self.app.geodata.update(region_de_iarc_exclude=True, region_br_iarc_exclude=True) fix_excluded_regions([self.app.pk]) self.assertSetEqual(self.app.get_excluded_region_ids(), [mkt.regions.DEU.id, mkt.regions.BRA.id]) eq_(self.app.addonexcludedregion.count(), 0)
def test_free_iarc_excluded(self, _mock): # Set a few exclusions that shouldn't survive. self.app.addonexcludedregion.create(region=mkt.regions.PE.id) self.app.addonexcludedregion.create(region=mkt.regions.FR.id) # Set IARC settings to influence region exclusions. self.app.geodata.update(region_de_iarc_exclude=True, region_br_iarc_exclude=True) fix_excluded_regions([self.app.pk]) self.assertSetEqual(self.app.get_excluded_region_ids(), [mkt.regions.DE.id, mkt.regions.BR.id]) eq_(self.app.addonexcludedregion.count(), 0)