Search extensions are always platform=ALL (whoops!). And fixed addon creation tests.
This commit is contained in:
Родитель
4150a75793
Коммит
67d5212be7
|
@ -767,7 +767,7 @@ class TestAddonFromUpload(files.tests.UploadTest):
|
|||
|
||||
def test_xpi_attributes(self):
|
||||
addon = Addon.from_upload(self.get_upload('extension.xpi'),
|
||||
self.platform)
|
||||
[self.platform])
|
||||
eq_(addon.name, 'xpi name')
|
||||
eq_(addon.guid, 'guid@xpi')
|
||||
eq_(addon.type, amo.ADDON_EXTENSION)
|
||||
|
@ -779,15 +779,24 @@ class TestAddonFromUpload(files.tests.UploadTest):
|
|||
|
||||
def test_xpi_version(self):
|
||||
addon = Addon.from_upload(self.get_upload('extension.xpi'),
|
||||
self.platform)
|
||||
[self.platform])
|
||||
v = addon.versions.get()
|
||||
eq_(v.version, '0.1')
|
||||
eq_(v.files.get().platform_id, self.platform.id)
|
||||
eq_(v.files.get().status, amo.STATUS_UNREVIEWED)
|
||||
|
||||
def test_xpi_for_multiple_platforms(self):
|
||||
platforms = [Platform.objects.get(pk=amo.PLATFORM_LINUX.id),
|
||||
Platform.objects.get(pk=amo.PLATFORM_MAC.id)]
|
||||
addon = Addon.from_upload(self.get_upload('extension.xpi'),
|
||||
platforms)
|
||||
v = addon.versions.get()
|
||||
eq_(sorted([f.platform.id for f in v.all_files]),
|
||||
sorted([p.id for p in platforms]))
|
||||
|
||||
def test_search_attributes(self):
|
||||
addon = Addon.from_upload(self.get_upload('search.xml'),
|
||||
self.platform)
|
||||
[self.platform])
|
||||
eq_(addon.name, 'search tool')
|
||||
eq_(addon.guid, None)
|
||||
eq_(addon.type, amo.ADDON_SEARCH)
|
||||
|
@ -799,7 +808,7 @@ class TestAddonFromUpload(files.tests.UploadTest):
|
|||
|
||||
def test_search_version(self):
|
||||
addon = Addon.from_upload(self.get_upload('search.xml'),
|
||||
self.platform)
|
||||
[self.platform])
|
||||
v = addon.versions.get()
|
||||
eq_(v.version, datetime.now().strftime('%Y%m%d'))
|
||||
eq_(v.files.get().platform_id, amo.PLATFORM_ALL.id)
|
||||
|
@ -807,5 +816,5 @@ class TestAddonFromUpload(files.tests.UploadTest):
|
|||
|
||||
def test_no_homepage(self):
|
||||
addon = Addon.from_upload(self.get_upload('extension-no-homepage.xpi'),
|
||||
self.platform)
|
||||
[self.platform])
|
||||
eq_(addon.homepage, None)
|
||||
|
|
|
@ -42,5 +42,14 @@
|
|||
"modified": "2008-04-07 08:16:55",
|
||||
"created": "2007-03-05 13:09:27"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 2,
|
||||
"model": "files.platform",
|
||||
"fields": {
|
||||
"icontype": "",
|
||||
"modified": "2008-04-07 08:16:55",
|
||||
"created": "2007-03-05 13:09:27"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -58,7 +58,8 @@ class Version(amo.models.ModelBase):
|
|||
AV(version=v, min=app.min, max=app.max,
|
||||
application_id=app.id).save()
|
||||
if addon.type == amo.ADDON_SEARCH:
|
||||
platform = Platform.objects.get(id=amo.PLATFORM_ALL.id)
|
||||
# Search extensions are always for all platforms.
|
||||
platforms = [Platform.objects.get(id=amo.PLATFORM_ALL.id)]
|
||||
for platform in platforms:
|
||||
File.from_upload(upload, v, platform, parse_data=data)
|
||||
# After the upload has been copied to all
|
||||
|
|
|
@ -534,18 +534,11 @@ class TestSearchVersionFromUpload(TestVersionFromUpload):
|
|||
[self.platform])
|
||||
files = version.all_files
|
||||
eq_(files[0].filename,
|
||||
u'delicious_bookmarks-%s-%s.xml' % (
|
||||
self.now, amo.PLATFORMS[self.platform.id].shortname))
|
||||
u'delicious_bookmarks-%s.xml' % self.now)
|
||||
|
||||
def test_file_name_platform_all(self):
|
||||
version = Version.from_upload(self.upload, self.addon,
|
||||
[Platform.objects.get(pk=amo.PLATFORM_ALL.id)])
|
||||
files = version.all_files
|
||||
eq_(files[0].filename, u'delicious_bookmarks-%s.xml' % self.now)
|
||||
|
||||
def test_file_platform(self):
|
||||
def test_file_platform_is_always_all(self):
|
||||
version = Version.from_upload(self.upload, self.addon,
|
||||
[self.platform])
|
||||
files = version.all_files
|
||||
eq_(len(files), 1)
|
||||
eq_(files[0].platform, self.platform)
|
||||
eq_(files[0].platform.id, amo.PLATFORM_ALL.id)
|
||||
|
|
Загрузка…
Ссылка в новой задаче