def test_too_long_uuid(self): """An add-on uuid must be 64chars at most, see bug 1201176.""" with self.assertRaises(forms.ValidationError) as exc: check_xpi_info({ 'guid': u'this_guid_is_longer_than_the_limit_of_64_chars_see_' u'bug_1201176_and_should_fail@xpi'}) expected = 'Add-on ID must be 64 characters or less.' assert exc.exception.message == expected
def test_long_uuid(self): """An add-on uuid may be more than 64 chars, see bug 1203915.""" self.create_switch('allow-long-addon-guid') long_guid = (u'this_guid_is_longer_than_the_limit_of_64_chars_see_' u'bug_1201176_but_should_not_fail_see_bug_1203915@xpi') xpi_info = check_xpi_info({'guid': long_guid, 'version': '1.0'}) assert xpi_info['guid'] == long_guid
def test_long_version_number(self): with self.assertRaises(forms.ValidationError) as e: check_xpi_info({'guid': 'guid', 'version': '1' * 33}) msg = e.exception.messages[0] eq_(msg, 'Version numbers should have fewer than 32 characters.')
def test_bad_version_number(self): with self.assertRaises(forms.ValidationError) as e: check_xpi_info({'guid': 'guid', 'version': 'bad #version'}) msg = e.exception.messages[0] assert msg.startswith('Version numbers should only contain'), msg
def test_good_version_number(self): check_xpi_info({'guid': 'guid', 'version': '1.2a-b+32*__yeah'}) check_xpi_info({'guid': 'guid', 'version': '1' * 32})
def test_long_version_number(self): with self.assertRaises(forms.ValidationError) as e: check_xpi_info({"guid": "guid", "version": "1" * 33}) msg = e.exception.messages[0] eq_(msg, "Version numbers should have fewer than 32 characters.")
def test_bad_version_number(self): with self.assertRaises(forms.ValidationError) as e: check_xpi_info({"guid": "guid", "version": "bad #version"}) msg = e.exception.messages[0] assert msg.startswith("Version numbers should only contain"), msg
def test_good_version_number(self): check_xpi_info({"guid": "guid", "version": "1.2a-b+32*__yeah"}) check_xpi_info({"guid": "guid", "version": "1" * 32})