def setUp(self): assert self.client.login(username='******', password='******') self.addon = self.get_addon() self.version = self.get_version() self.url = reverse('devhub.versions.edit', args=['a3615', self.version.id]) self.v1 = AppVersion(application_id=amo.FIREFOX.id, version='1.0') self.v4 = AppVersion(application_id=amo.FIREFOX.id, version='4.0') for v in self.v1, self.v4: v.save()
def test_add_not(self): for id in [18, 52, 59, 60, 61]: av = AppVersion(application=id, version="1") av.save() ApplicationsVersions(application=id, min=av, max=av, version=self.version).save() res = self.client.get(self.url) doc = pq(res.content) assert not res.context["compat_form"].extra_forms assert doc("p.add-app")[0].attrib["class"] == "add-app hide"
def test_add_not(self): for id in [18, 52, 59, 60, 61]: av = AppVersion(application=id, version='1') av.save() ApplicationsVersions(application=id, min=av, max=av, version=self.version).save() res = self.client.get(self.url) doc = pq(res.content) assert not res.context['compat_form'].extra_forms assert doc('p.add-app')[0].attrib['class'] == 'add-app hide'
def setUp(self): super(TestFileFromUpload, self).setUp() appver = {amo.FIREFOX: ['3.0', '3.6', '3.6.*', '4.0b6'], amo.MOBILE: ['0.1', '2.0a1pre']} for app, versions in appver.items(): for version in versions: AppVersion(application_id=app.id, version=version).save() self.platform = Platform.objects.create(id=amo.PLATFORM_MAC.id) self.addon = Addon.objects.create(guid='guid@jetpack', type=amo.ADDON_EXTENSION, name='xxx') self.version = Version.objects.create(addon=self.addon)
def test_major_minor(self): """Check that major/minor/alpha is getting set.""" v = AppVersion(version='3.0.12b2') eq_(v.major, 3) eq_(v.minor1, 0) eq_(v.minor2, 12) eq_(v.minor3, None) eq_(v.alpha, 'b') eq_(v.alpha_ver, 2) v = AppVersion(version='3.6.1apre2+') eq_(v.major, 3) eq_(v.minor1, 6) eq_(v.minor2, 1) eq_(v.alpha, 'a') eq_(v.pre, 'pre') eq_(v.pre_ver, 2) v = AppVersion(version='') eq_(v.major, None) eq_(v.minor1, None) eq_(v.minor2, None) eq_(v.minor3, None)