Exemple #1
0
 def test_new(self):
     """
     New add-ons shouldn't be able to use existing add-on names.
     """
     f = forms.AddonForm(dict(name=self.existing_name))
     assert not f.is_valid()
     eq_(f.errors['name'][0], self.error_msg)
Exemple #2
0
 def test_new(self):
     """
     New add-ons should be able to use non-existing add-on names.
     """
     f = forms.AddonForm(dict(name=self.non_existing_name))
     f.is_valid()
     eq_(f.errors.get('name'), None)
Exemple #3
0
 def test_update_addon_existing_name_used_by_other_type(self):
     """An add-on edit can change the name to an existing name used by
     another add-on type."""
     addon = addon_factory(name='some name', type=amo.ADDON_PERSONA)
     form = forms.AddonForm(dict(name=self.existing_name), instance=addon)
     form.is_valid()
     assert 'name' not in form.errors
Exemple #4
0
 def test_update_addon_existing_name_used_by_listed(self):
     """An unlisted add-on edit can change the name to an existing name used
     by an listed add-on."""
     addon = addon_factory(name='some name', is_listed=False)
     form = forms.AddonForm(dict(name=self.existing_name), instance=addon)
     form.is_valid()
     assert 'name' not in form.errors
Exemple #5
0
 def test_update_addon_non_existing_name(self):
     """An add-on edit can change the name to any non-existing name."""
     addon = addon_factory(name='some name')
     form = forms.AddonForm(dict(name=self.non_existing_name),
                            instance=addon)
     form.is_valid()
     assert 'name' not in form.errors
Exemple #6
0
 def test_update_addon_existing_name(self):
     """An add-on edit can't change the name to an existing add-on name."""
     addon = addon_factory(name='some name')
     form = forms.AddonForm(dict(name=self.existing_name), instance=addon)
     assert not form.is_valid()
     assert form.errors['name'][0] == self.error_msg