watch out for unknown app guids (bug 616043)
This commit is contained in:
Родитель
2003decc54
Коммит
6313a26336
Двоичный файл не отображается.
|
@ -125,8 +125,8 @@ class TestParseXpi(test_utils.TestCase):
|
|||
for version in ('3.0', '3.6.*'):
|
||||
AppVersion.objects.create(application_id=1, version=version)
|
||||
|
||||
def parse(self, addon=None):
|
||||
path = 'apps/files/fixtures/files/extension.xpi'
|
||||
def parse(self, addon=None, filename='extension.xpi'):
|
||||
path = 'apps/files/fixtures/files/' + filename
|
||||
xpi = os.path.join(settings.ROOT, path)
|
||||
return parse_xpi(xpi, addon)
|
||||
|
||||
|
@ -180,6 +180,10 @@ class TestParseXpi(test_utils.TestCase):
|
|||
eq_(e.exception.messages,
|
||||
["<em:type> doesn't match add-on"])
|
||||
|
||||
def test_unknown_app(self):
|
||||
data = self.parse(filename='theme-invalid-app.jar')
|
||||
eq_(data['apps'], [])
|
||||
|
||||
# parse_dictionary
|
||||
# parse_theme
|
||||
# parse_langpack
|
||||
|
|
|
@ -84,6 +84,8 @@ def parse_xpi(xpi, addon=None):
|
|||
App = collections.namedtuple('App', 'appdata id min max')
|
||||
for node in rdf.getElementsByTagName('em:targetApplication'):
|
||||
app = amo.APP_GUIDS.get(get_text_value(node, 'id'))
|
||||
if not app:
|
||||
continue
|
||||
min_val = get_text_value(node, 'minVersion')
|
||||
max_val = get_text_value(node, 'maxVersion')
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче