Exemplo n.º 1
0
    def save(self):
        if not self.version:
            return

        data = self.cleaned_data

        # check existing AVs
        try:
            c = self.version.apps.get(application=data['app'].id)
        except ApplicationsVersions.DoesNotExist:
            c = ApplicationsVersions(application_id=data['app'].id,
                                     version=self.version)

        c.min = data['min']
        c.max = data['max']
        c.save()
        return c
Exemplo n.º 2
0
 def test_mozilla_app(self):
     moz = amo.MOZILLA
     appver = AppVersion.objects.create(application=moz.id)
     v = Addon.objects.get(id=3615).current_version
     ApplicationsVersions(application=moz.id, version=v,
                          min=appver, max=appver).save()
     fs = forms.CompatFormSet(None, queryset=v.apps.all())
     apps = [f.app for f in fs.forms]
     assert moz in apps
Exemplo n.º 3
0
    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'