def run():
    """
    Migrate from New Mexico to Old Mexico. Then add AddonExcludedRegion
    objects for those apps that opted out of being added to new regions.
    """

    # There were two Mexicos (12 is the first; 18 was the second one).
    for aer in AddonExcludedRegion.objects.filter(region=18):
        try:
            aer.update(region=mkt.regions.MX.id)
            print('OK: %s New Mexico -> Old Mexico' % aer.id)
        except (IntegrityError, ObjectDoesNotExist):
            print('SKIP: %s New Mexico -> Old Mexico' % aer.id)

    # And the featured apps, if there were any.
    for far in FeaturedAppRegion.objects.filter(region=18):
        try:
            far.update(region=mkt.regions.MX.id)
            print('OK: %s New Mexico -> Old Mexico' % far.id)
        except (IntegrityError, ObjectDoesNotExist):
            print('SKIP: %s New Mexico -> Old Mexico' % far.id)

    # New regions were added.
    exclude_new_region([
        mkt.regions.MX,
        mkt.regions.HU,
        mkt.regions.DE,
        mkt.regions.ME,
        mkt.regions.RS,
        mkt.regions.GR,
    ])
def run():
    """
    Migrate from New Mexico to Old Mexico. Then add AddonExcludedRegion
    objects for those apps that opted out of being added to new regions.
    """

    # There were two Mexicos (12 is the first; 18 was the second one).
    for aer in AddonExcludedRegion.objects.filter(region=18):
        try:
            aer.update(region=mkt.regions.MX.id)
            print 'OK: %s New Mexico -> Old Mexico' % aer.id
        except (IntegrityError, ObjectDoesNotExist):
            print 'SKIP: %s New Mexico -> Old Mexico' % aer.id

    # And the featured apps, if there were any.
    for far in FeaturedAppRegion.objects.filter(region=18):
        try:
            far.update(region=mkt.regions.MX.id)
            print 'OK: %s New Mexico -> Old Mexico' % far.id
        except (IntegrityError, ObjectDoesNotExist):
            print 'SKIP: %s New Mexico -> Old Mexico' % far.id

    # New regions were added.
    exclude_new_region([
        mkt.regions.MX,
        mkt.regions.HU,
        mkt.regions.DE,
        mkt.regions.ME,
        mkt.regions.RS,
        mkt.regions.GR,
    ])
def run():
    exclude_new_region([
        regions.CR,
        regions.EC,
        regions.FR,
        regions.GT,
        regions.IT,
        regions.NI,
        regions.PA,
        regions.SV,
    ])
def run():
    exclude_new_region([
        regions.ABW, regions.AFG, regions.AGO, regions.AIA, regions.ALA,
        regions.ALB, regions.AND, regions.ARE, regions.ARM, regions.ASM,
        regions.ATA, regions.ATF, regions.ATG, regions.AUS, regions.AUT,
        regions.AZE, regions.BDI, regions.BEL, regions.BEN, regions.BES,
        regions.BFA, regions.BGR, regions.BHR, regions.BHS, regions.BIH,
        regions.BLM, regions.BLR, regions.BLZ, regions.BMU, regions.BOL,
        regions.BRB, regions.BRN, regions.BTN, regions.BVT, regions.CAN,
        regions.CCK, regions.CHE, regions.COD, regions.COG, regions.C*K,
        regions.COM, regions.CPV, regions.CUB, regions.CUW, regions.CXR,
        regions.CYM, regions.CYP, regions.DJI, regions.DMA, regions.DNK,
        regions.DOM, regions.DZA, regions.ERI, regions.ESH, regions.EST,
        regions.ETH, regions.FIN, regions.FJI, regions.FLK, regions.FRO,
        regions.FSM, regions.GAB, regions.GEO, regions.GGY, regions.GHA,
        regions.GIB, regions.GLP, regions.GMB, regions.GNQ, regions.GRD,
        regions.GRL, regions.GUF, regions.GUM, regions.GUY, regions.HKG,
        regions.HMD, regions.HND, regions.HRV, regions.HTI, regions.IDN,
        regions.IMN, regions.IOT, regions.IRL, regions.IRQ, regions.ISL,
        regions.ISR, regions.JAM, regions.JEY, regions.KAZ, regions.KGZ,
        regions.KHM, regions.KIR, regions.KNA, regions.KOR, regions.KWT,
        regions.LAO, regions.LBN, regions.LBR, regions.LBY, regions.LCA,
        regions.LIE, regions.LKA, regions.LSO, regions.LUX, regions.LVA,
        regions.MAC, regions.MAF, regions.MAR, regions.MCO, regions.MDA,
        regions.MDV, regions.MHL, regions.MKD, regions.MLT, regions.MNG,
        regions.MNP, regions.MOZ, regions.MRT, regions.MSR, regions.MTQ,
        regions.MWI, regions.MYS, regions.MYT, regions.NAM, regions.NCL,
        regions.NFK, regions.NGA, regions.NIU, regions.NLD, regions.NOR,
        regions.NPL, regions.NRU, regions.NZL, regions.OMN, regions.PAK,
        regions.PCN, regions.PLW, regions.PNG, regions.PRI, regions.PRT,
        regions.PRY, regions.PSE, regions.PYF, regions.QAT, regions.REU,
        regions.ROU, regions.RWA, regions.SAU, regions.SDN, regions.SGP,
        regions.SGS, regions.SHN, regions.SJM, regions.SLB, regions.SLE,
        regions.SMR, regions.SOM, regions.SPM, regions.SSD, regions.STP,
        regions.SUR, regions.SVK, regions.SVN, regions.SWE, regions.SWZ,
        regions.SXM, regions.SYC, regions.SYR, regions.TCA, regions.TCD,
        regions.TGO, regions.THA, regions.TJK, regions.TKL, regions.TKM,
        regions.TLS, regions.TON, regions.TTO, regions.TUR, regions.TUV,
        regions.UGA, regions.UKR, regions.UMI, regions.UZB, regions.VAT,
        regions.VCT, regions.VGB, regions.VIR, regions.VNM, regions.WLF,
        regions.WSM, regions.YEM, regions.ZMB, regions.ZWE
    ])
Example #5
0
 def test_not_called_enable_new_regions_true(self, _region_exclude_mock):
     self.app.update(enable_new_regions=True)
     exclude_new_region([mkt.regions.UK])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [])
Example #6
0
 def test_not_called_with_ordinary_exclusions(self, _region_exclude_mock):
     AddonExcludedRegion.objects.create(addon=self.app,
                                        region=mkt.regions.UK.id)
     exclude_new_region([mkt.regions.UK])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [])
Example #7
0
def run():
    exclude_new_region([regions.RU, regions.PH])
Example #8
0
 def test_not_called_with_ordinary_exclusions(self, _region_exclude_mock):
     self.app.addonexcludedregion.create(region=mkt.regions.UK.id)
     exclude_new_region([mkt.regions.UK])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [])
Example #9
0
def run():
    exclude_new_region([regions.JP])
Example #10
0
 def test_not_called_with_ordinary_exclusions(self, _region_exclude_mock):
     self.app.addonexcludedregion.create(region=mkt.regions.UK.id)
     exclude_new_region([mkt.regions.UK])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [])
Example #11
0
def run():
    exclude_new_region([regions.ZA])
Example #12
0
 def test_not_called_with_ordinary_exclusions(self, _region_exclude_mock):
     AddonExcludedRegion.objects.create(addon=self.app,
         region=mkt.regions.CA.id)
     exclude_new_region([mkt.regions.CA])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [])
Example #13
0
 def test_called_with_enable_new_regions_false(self, _region_exclude_mock):
     # Check enable_new_regions is False by default.
     eq_(self.app.enable_new_regions, False)
     exclude_new_region([mkt.regions.UK])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [self.app.id])
Example #14
0
def run():
    exclude_new_region([regions.CZ])
def run():
    exclude_new_region([
        regions.BWA, regions.CIV, regions.CMR, regions.EGY, regions.GNB,
        regions.JOR, regions.LTU, regions.MDG, regions.MLI, regions.MMR,
        regions.MUS, regions.NER, regions.SEN, regions.TUN, regions.TZA,
        regions.VUT])
Example #16
0
 def test_called_with_future_exclusions(self, _region_exclude_mock):
     AddonExcludedRegion.objects.create(addon=self.app,
                                        region=mkt.regions.WORLDWIDE.id)
     exclude_new_region([mkt.regions.CA])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [self.app.id])
Example #17
0
 def test_not_called_by_default(self, _region_exclude_mock):
     exclude_new_region([mkt.regions.CA])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [])
Example #18
0
def run():
    exclude_new_region([regions.RU, regions.PH])
Example #19
0
 def test_not_called_enable_new_regions_true(self, _region_exclude_mock):
     eq_(self.app.enable_new_regions, True)
     exclude_new_region([mkt.regions.GBR])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [])
Example #20
0
 def test_not_called_by_default(self, _region_exclude_mock):
     exclude_new_region([mkt.regions.CA])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]),
         [])
Example #21
0
 def test_not_called_enable_new_regions_true(self, _region_exclude_mock):
     eq_(self.app.enable_new_regions, True)
     exclude_new_region([mkt.regions.GBR])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [])
Example #22
0
 def test_called_with_future_exclusions(self, _region_exclude_mock):
     AddonExcludedRegion.objects.create(addon=self.app,
         region=mkt.regions.WORLDWIDE.id)
     exclude_new_region([mkt.regions.CA])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [self.app.id])
Example #23
0
def run():
    exclude_new_region([regions.IN])
Example #24
0
 def test_not_called_enable_new_regions_true(self, _region_exclude_mock):
     self.app.update(enable_new_regions=True)
     exclude_new_region([mkt.regions.UK])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [])
def run():
    exclude_new_region([regions.BD])
Example #26
0
 def test_called_with_enable_new_regions_false(self, _region_exclude_mock):
     # Check enable_new_regions is False by default.
     eq_(self.app.enable_new_regions, False)
     exclude_new_region([mkt.regions.UK])
     eq_(list(_region_exclude_mock.call_args_list[0][0][0]), [self.app.id])
def run():
    exclude_new_region([regions.CAF, regions.GIN, regions.KEN])