Remove applications.Application (bug 1068591)
This commit is contained in:
Родитель
9432b49fe0
Коммит
657929945b
|
@ -75,7 +75,7 @@ class ACLTestCase(TestCase):
|
|||
|
||||
|
||||
class TestHasPerm(TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='del@icio.us', password='password')
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
[
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2011-07-29 09:20:37",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 233,
|
||||
"model": "applications.appversion",
|
||||
|
|
|
@ -94,15 +94,6 @@
|
|||
"addon": 3723
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 73083,
|
||||
"model": "versions.applicationsversions",
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
[
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 4,
|
||||
"model": "bandwagon.collectionfeature",
|
||||
|
|
|
@ -1,22 +1,4 @@
|
|||
[
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 18,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{zzz}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "addons.addon",
|
||||
|
|
|
@ -597,61 +597,6 @@
|
|||
"min": 103
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 2,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{86c18b42-e466-45a9-ae7a-9b95ba6f5640}",
|
||||
"modified": "2008-11-03 15:35:00",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 18,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{3550f703-e582-4d05-9a08-453d09bdfdc6}",
|
||||
"modified": "2008-06-17 08:29:00",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 52,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{718e30fb-e89b-41dd-9da7-e25a45638b28}",
|
||||
"supported": "0",
|
||||
"modified": "2008-06-17 08:29:01",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 59,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}",
|
||||
"modified": "2008-06-17 08:29:01",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 60,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{a23983c0-fd0e-11dc-95ff-0800200c9a66}",
|
||||
"modified": "2010-09-28 10:50:30",
|
||||
"created": "2008-10-28 18:25:09"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 411,
|
||||
"model": "applications.appversion",
|
||||
|
|
|
@ -22,7 +22,6 @@ from addons.models import (Addon, AddonCategory, BlacklistedSlug, Category,
|
|||
from addons.tasks import save_theme, save_theme_reupload
|
||||
from addons.utils import reverse_name_lookup
|
||||
from addons.widgets import IconWidgetRenderer, CategoriesSelectMultiple
|
||||
from applications.models import Application
|
||||
from devhub import tasks as devhub_tasks
|
||||
from tags.models import Tag
|
||||
from translations import LOCALES
|
||||
|
@ -184,16 +183,10 @@ class AppFormBasic(AddonFormBasic):
|
|||
name = TransField(max_length=128)
|
||||
|
||||
|
||||
class ApplicationChoiceField(forms.ModelChoiceField):
|
||||
|
||||
def label_from_instance(self, obj):
|
||||
return obj.id
|
||||
|
||||
|
||||
class CategoryForm(forms.Form):
|
||||
application = ApplicationChoiceField(Application.objects.all(),
|
||||
widget=forms.HiddenInput,
|
||||
required=False)
|
||||
application = forms.ChoiceField(amo.APPS_CHOICES,
|
||||
widget=forms.HiddenInput,
|
||||
required=False)
|
||||
categories = forms.ModelMultipleChoiceField(
|
||||
queryset=Category.objects.all(), widget=CategoriesSelectMultiple)
|
||||
|
||||
|
@ -201,8 +194,8 @@ class CategoryForm(forms.Form):
|
|||
application = self.cleaned_data['application']
|
||||
categories_new = self.cleaned_data['categories']
|
||||
categories_old = [cats for app, cats in addon.app_categories if
|
||||
(app and application and app.id == application.id) or
|
||||
(not app and not application)]
|
||||
(app and application and app.id == int(application))
|
||||
or (not app and not application)]
|
||||
if categories_old:
|
||||
categories_old = categories_old[0]
|
||||
|
||||
|
@ -251,7 +244,7 @@ class BaseCategoryFormSet(BaseFormSet):
|
|||
# Drop any apps that don't have appropriate categories.
|
||||
qs = Category.objects.filter(type=self.addon.type)
|
||||
app_cats = dict((k, list(v)) for k, v in
|
||||
sorted_groupby(qs, 'application_id'))
|
||||
sorted_groupby(qs, 'application'))
|
||||
for app in list(apps):
|
||||
if app and not app_cats.get(app.id):
|
||||
apps.remove(app)
|
||||
|
|
|
@ -613,7 +613,7 @@ class Addon(amo.models.OnChangeMixin, amo.models.ModelBase):
|
|||
status_list = ','.join(map(str, status))
|
||||
fltr = {'files__status__in': status}
|
||||
if backup_version:
|
||||
fltr['apps__application__id'] = amo.FIREFOX.id
|
||||
fltr['apps__application'] = amo.FIREFOX.id
|
||||
fltr['apps__min__version_int__lt'] = amo.FIREFOX.backup_version
|
||||
return self.versions.no_cache().filter(**fltr).extra(
|
||||
where=["""
|
||||
|
@ -772,13 +772,12 @@ class Addon(amo.models.OnChangeMixin, amo.models.ModelBase):
|
|||
ON addons.id = versions.addon_id AND addons.id = %(id)s
|
||||
INNER JOIN applications_versions
|
||||
ON applications_versions.version_id = versions.id
|
||||
INNER JOIN applications
|
||||
ON applications_versions.application_id = applications.id
|
||||
AND applications.id = %(app_id)s
|
||||
INNER JOIN appversions appmin
|
||||
ON appmin.id = applications_versions.min
|
||||
AND appmin.application_id = %(app_id)s
|
||||
INNER JOIN appversions appmax
|
||||
ON appmax.id = applications_versions.max
|
||||
AND appmax.application_id = %(app_id)s
|
||||
INNER JOIN files
|
||||
ON files.version_id = versions.id AND
|
||||
(files.platform_id = 1"""]
|
||||
|
@ -1342,7 +1341,7 @@ class Addon(amo.models.OnChangeMixin, amo.models.ModelBase):
|
|||
def app_categories(self):
|
||||
categories = sorted_groupby(order_by_translation(self.categories.all(),
|
||||
'name'),
|
||||
key=lambda x: x.application_id)
|
||||
key=lambda x: x.application)
|
||||
app_cats = []
|
||||
for app_id, cats in categories:
|
||||
app = amo.APP_IDS.get(app_id)
|
||||
|
@ -1926,8 +1925,8 @@ class Category(amo.models.OnChangeMixin, amo.models.ModelBase):
|
|||
help_text='Used in Category URLs.')
|
||||
type = models.PositiveIntegerField(db_column='addontype_id',
|
||||
choices=do_dictsort(amo.ADDON_TYPE))
|
||||
application = models.ForeignKey('applications.Application', null=True,
|
||||
blank=True)
|
||||
application = models.PositiveIntegerField(null=True, blank=True,
|
||||
db_column='application_id')
|
||||
count = models.IntegerField('Addon count', default=0)
|
||||
weight = models.IntegerField(
|
||||
default=0, help_text='Category weight used in sort ordering')
|
||||
|
@ -1978,7 +1977,7 @@ class Feature(amo.models.ModelBase):
|
|||
start = models.DateTimeField()
|
||||
end = models.DateTimeField()
|
||||
locale = models.CharField(max_length=10, default='', blank=True, null=True)
|
||||
application = models.ForeignKey('applications.Application')
|
||||
application = models.PositiveIntegerField(db_column='application_id')
|
||||
|
||||
class Meta:
|
||||
db_table = 'features'
|
||||
|
@ -2088,7 +2087,7 @@ dbsignals.pre_save.connect(save_signal, sender=Preview,
|
|||
class AppSupport(amo.models.ModelBase):
|
||||
"""Cache to tell us if an add-on's current version supports an app."""
|
||||
addon = models.ForeignKey(Addon)
|
||||
app = models.ForeignKey('applications.Application')
|
||||
app = models.PositiveIntegerField(db_column='app_id')
|
||||
min = models.BigIntegerField("Minimum app version", null=True)
|
||||
max = models.BigIntegerField("Maximum app version", null=True)
|
||||
|
||||
|
@ -2212,7 +2211,7 @@ class CompatOverride(amo.models.ModelBase):
|
|||
item = Range(first.override_type(), first.min_version,
|
||||
first.max_version, [])
|
||||
for compat in compats:
|
||||
app = AppRange(amo.APPS_ALL[compat.app_id],
|
||||
app = AppRange(amo.APPS_ALL[compat.app],
|
||||
compat.min_app_version, compat.max_app_version)
|
||||
item.apps.append(app)
|
||||
rv.append(item)
|
||||
|
@ -2237,7 +2236,7 @@ class CompatOverrideRange(amo.models.ModelBase):
|
|||
max_length=255, default='*',
|
||||
help_text=u'If not "*", version is required to exist for the override'
|
||||
u' to take effect.')
|
||||
app = models.ForeignKey('applications.Application')
|
||||
app = models.PositiveIntegerField(db_column='app_id')
|
||||
min_app_version = models.CharField(max_length=255, default='0')
|
||||
max_app_version = models.CharField(max_length=255, default='*')
|
||||
|
||||
|
@ -2260,7 +2259,7 @@ class IncompatibleVersions(amo.models.ModelBase):
|
|||
a particular version falls within the range of a compatibility override.
|
||||
"""
|
||||
version = models.ForeignKey(Version, related_name='+')
|
||||
app = models.ForeignKey('applications.Application', related_name='+')
|
||||
app = models.PositiveIntegerField(db_column='app_id')
|
||||
min_app_version = models.CharField(max_length=255, blank=True, default='0')
|
||||
max_app_version = models.CharField(max_length=255, blank=True, default='*')
|
||||
min_app_version_int = models.BigIntegerField(blank=True, null=True,
|
||||
|
|
|
@ -252,7 +252,7 @@ def update_incompatible_appversions(data, **kw):
|
|||
|
||||
for app_range in app_ranges:
|
||||
IncompatibleVersions.objects.create(version=version,
|
||||
app_id=app_range.app.id,
|
||||
app=app_range.app.id,
|
||||
min_app_version=app_range.min,
|
||||
max_app_version=app_range.max)
|
||||
log.info('Added incompatible version for version ID [%d]: '
|
||||
|
|
|
@ -570,7 +570,7 @@ class TestBackup(ButtonTest):
|
|||
|
||||
|
||||
class TestViews(amo.tests.TestCase):
|
||||
fixtures = ['addons/eula+contrib-addon', 'base/apps']
|
||||
fixtures = ['addons/eula+contrib-addon']
|
||||
|
||||
def test_eula_with_contrib_roadblock(self):
|
||||
url = reverse('addons.eula', args=[11730, 53612])
|
||||
|
|
|
@ -34,7 +34,7 @@ class CurrentVersionTestCase(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestLastUpdated(amo.tests.TestCase):
|
||||
fixtures = ['base/addon_3615', 'addons/listed', 'base/apps',
|
||||
fixtures = ['base/addon_3615', 'addons/listed',
|
||||
'addons/persona', 'base/seamonkey', 'base/thunderbird']
|
||||
|
||||
def test_personas(self):
|
||||
|
|
|
@ -271,11 +271,10 @@ class TestIconForm(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestCategoryForm(amo.tests.TestCase):
|
||||
fixtures = ['base/apps']
|
||||
|
||||
def test_no_possible_categories(self):
|
||||
Category.objects.create(type=amo.ADDON_SEARCH,
|
||||
application_id=amo.FIREFOX.id)
|
||||
application=amo.FIREFOX.id)
|
||||
addon = Addon.objects.create(type=amo.ADDON_SEARCH)
|
||||
form = forms.CategoryFormSet(addon=addon)
|
||||
apps = [f.app for f in form.forms]
|
||||
|
|
|
@ -27,7 +27,7 @@ from addons.models import (Addon, AddonCategory, AddonDependency,
|
|||
CompatOverrideRange, FrozenAddon,
|
||||
IncompatibleVersions, Persona, Preview)
|
||||
from addons.search import setup_mapping
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from constants.applications import DEVICE_TYPES
|
||||
from devhub.models import ActivityLog, AddonLog, RssKey, SubmitStep
|
||||
from editors.models import EscalationQueue
|
||||
|
@ -180,7 +180,7 @@ class TestCleanSlug(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestAddonManager(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/appversion', 'base/users',
|
||||
fixtures = ['base/appversion', 'base/users',
|
||||
'base/addon_3615', 'addons/featured', 'addons/test_manager',
|
||||
'base/collections', 'base/featured',
|
||||
'bandwagon/featured_collections', 'base/addon_5299_gcal']
|
||||
|
@ -199,8 +199,9 @@ class TestAddonManager(amo.tests.TestCase):
|
|||
q = Addon.objects.listed(amo.FIREFOX, amo.STATUS_PUBLIC)
|
||||
eq_(len(q.all()), 4)
|
||||
|
||||
addon = q[0]
|
||||
eq_(addon.id, 2464)
|
||||
# Pick one of the listed addons.
|
||||
addon = Addon.objects.get(pk=2464)
|
||||
assert addon in q.all()
|
||||
|
||||
# Disabling hides it.
|
||||
addon.disabled_by_user = True
|
||||
|
@ -296,8 +297,7 @@ class TestAddonManager(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestAddonModels(amo.tests.TestCase):
|
||||
fixtures = ['base/apps',
|
||||
'base/appversion',
|
||||
fixtures = ['base/appversion',
|
||||
'base/collections',
|
||||
'base/featured',
|
||||
'base/users',
|
||||
|
@ -384,7 +384,7 @@ class TestAddonModels(amo.tests.TestCase):
|
|||
v = Version.objects.create(addon=addon, version='99')
|
||||
File.objects.create(status=status, version=v)
|
||||
|
||||
ApplicationsVersions.objects.create(application_id=amo.FIREFOX.id,
|
||||
ApplicationsVersions.objects.create(application=amo.FIREFOX.id,
|
||||
version=v, min=av.min, max=av.max)
|
||||
return v
|
||||
|
||||
|
@ -510,7 +510,7 @@ class TestAddonModels(amo.tests.TestCase):
|
|||
|
||||
def test_incompatible_asterix(self):
|
||||
av = ApplicationsVersions.objects.get(pk=47881)
|
||||
av.max = AppVersion.objects.create(application_id=amo.FIREFOX.id,
|
||||
av.max = AppVersion.objects.create(application=amo.FIREFOX.id,
|
||||
version_int=version_int('5.*'),
|
||||
version='5.*')
|
||||
av.save()
|
||||
|
@ -972,15 +972,14 @@ class TestAddonModels(amo.tests.TestCase):
|
|||
cats = addon().all_categories
|
||||
eq_(cats, [c22, c23, c24])
|
||||
for cat in cats:
|
||||
eq_(cat.application.id, amo.FIREFOX.id)
|
||||
eq_(cat.application, amo.FIREFOX.id)
|
||||
|
||||
cats = [c24, c23, c22]
|
||||
app_cats = [(amo.FIREFOX, cats)]
|
||||
eq_(addon().app_categories, app_cats)
|
||||
|
||||
tb = Application.objects.get(id=amo.THUNDERBIRD.id)
|
||||
c = Category(application=tb, name='XXX', type=addon().type, count=1,
|
||||
weight=1)
|
||||
c = Category(application=amo.THUNDERBIRD.id, name='XXX',
|
||||
type=addon().type, count=1, weight=1)
|
||||
c.save()
|
||||
AddonCategory.objects.create(addon=addon(), category=c)
|
||||
c24.save() # Clear the app_categories cache.
|
||||
|
@ -996,9 +995,8 @@ class TestAddonModels(amo.tests.TestCase):
|
|||
eq_(addon.app_categories, [(amo.FIREFOX, cats)])
|
||||
|
||||
# Associate this add-on with a Sunbird category.
|
||||
a = Application.objects.create(id=amo.SUNBIRD.id)
|
||||
c2 = Category.objects.create(application=a, type=amo.ADDON_EXTENSION,
|
||||
name='Sunny D')
|
||||
c2 = Category.objects.create(application=amo.SUNBIRD.id,
|
||||
type=amo.ADDON_EXTENSION, name='Sunny D')
|
||||
AddonCategory.objects.create(addon=addon, category=c2)
|
||||
|
||||
# Sunbird category should be excluded.
|
||||
|
@ -1470,8 +1468,7 @@ class TestAddonDelete(amo.tests.TestCase):
|
|||
other_addon=addon, score=0)
|
||||
AddonUser.objects.create(addon=addon,
|
||||
user=UserProfile.objects.create())
|
||||
AppSupport.objects.create(addon=addon,
|
||||
app=Application.objects.create())
|
||||
AppSupport.objects.create(addon=addon, app=1)
|
||||
CompatOverride.objects.create(addon=addon)
|
||||
FrozenAddon.objects.create(addon=addon)
|
||||
Persona.objects.create(addon=addon, persona_id=0)
|
||||
|
@ -1600,7 +1597,7 @@ class TestAddonGetURLPath(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestAddonModelsFeatured(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/appversion', 'base/users',
|
||||
fixtures = ['base/appversion', 'base/users',
|
||||
'addons/featured', 'bandwagon/featured_collections',
|
||||
'base/addon_3615', 'base/collections', 'base/featured']
|
||||
|
||||
|
@ -1622,7 +1619,7 @@ class TestAddonModelsFeatured(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestBackupVersion(amo.tests.TestCase):
|
||||
fixtures = ['addons/update', 'base/apps', 'base/appversion']
|
||||
fixtures = ['addons/update', 'base/appversion']
|
||||
|
||||
def setUp(self):
|
||||
self.version_1_2_0 = 105387
|
||||
|
@ -1818,8 +1815,7 @@ class TestAddonRecommendations(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestAddonDependencies(amo.tests.TestCase):
|
||||
fixtures = ['base/apps',
|
||||
'base/appversion',
|
||||
fixtures = ['base/appversion',
|
||||
'base/users',
|
||||
'base/addon_5299_gcal',
|
||||
'base/addon_3615',
|
||||
|
@ -1857,8 +1853,7 @@ class TestListedAddonTwoVersions(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestFlushURLs(amo.tests.TestCase):
|
||||
fixtures = ['base/apps',
|
||||
'base/appversion',
|
||||
fixtures = ['base/appversion',
|
||||
'base/users',
|
||||
'base/addon_5579',
|
||||
'base/previews',
|
||||
|
@ -1904,7 +1899,7 @@ class TestFlushURLs(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestAddonFromUpload(UploadTest):
|
||||
fixtures = ('base/apps', 'base/users')
|
||||
fixtures = ['base/users']
|
||||
|
||||
def setUp(self):
|
||||
super(TestAddonFromUpload, self).setUp()
|
||||
|
@ -1912,7 +1907,7 @@ class TestAddonFromUpload(UploadTest):
|
|||
set_user(u)
|
||||
self.platform = amo.PLATFORM_MAC.id
|
||||
for version in ('3.0', '3.6.*'):
|
||||
AppVersion.objects.create(application_id=1, version=version)
|
||||
AppVersion.objects.create(application=1, version=version)
|
||||
self.addCleanup(translation.deactivate)
|
||||
|
||||
def manifest(self, basename):
|
||||
|
@ -2257,15 +2252,15 @@ class TestLanguagePack(amo.tests.TestCase, amo.tests.AMOPaths):
|
|||
class TestCompatOverride(amo.tests.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.app = Application.objects.create(id=1)
|
||||
self.app = amo.APP_IDS[1]
|
||||
|
||||
one = CompatOverride.objects.create(guid='one')
|
||||
CompatOverrideRange.objects.create(compat=one, app=self.app)
|
||||
CompatOverrideRange.objects.create(compat=one, app=self.app.id)
|
||||
|
||||
two = CompatOverride.objects.create(guid='two')
|
||||
CompatOverrideRange.objects.create(compat=two, app=self.app,
|
||||
CompatOverrideRange.objects.create(compat=two, app=self.app.id,
|
||||
min_version='1', max_version='2')
|
||||
CompatOverrideRange.objects.create(compat=two, app=self.app,
|
||||
CompatOverrideRange.objects.create(compat=two, app=self.app.id,
|
||||
min_version='1', max_version='2',
|
||||
min_app_version='3',
|
||||
max_app_version='4')
|
||||
|
@ -2288,10 +2283,10 @@ class TestCompatOverride(amo.tests.TestCase):
|
|||
one = CompatOverride.objects.get(guid='one')
|
||||
|
||||
# The default is incompatible.
|
||||
c = CompatOverrideRange.objects.create(compat=one, app_id=1)
|
||||
c = CompatOverrideRange.objects.create(compat=one, app=1)
|
||||
eq_(c.override_type(), 'incompatible')
|
||||
|
||||
c = CompatOverrideRange.objects.create(compat=one, app_id=1, type=0)
|
||||
c = CompatOverrideRange.objects.create(compat=one, app=1, type=0)
|
||||
eq_(c.override_type(), 'compatible')
|
||||
|
||||
def test_guid_match(self):
|
||||
|
@ -2327,7 +2322,7 @@ class TestCompatOverride(amo.tests.TestCase):
|
|||
|
||||
def test_collapsed_ranges_multiple_versions(self):
|
||||
c = CompatOverride.objects.get(guid='one')
|
||||
CompatOverrideRange.objects.create(compat=c, app_id=1,
|
||||
CompatOverrideRange.objects.create(compat=c, app=1,
|
||||
min_version='1', max_version='2',
|
||||
min_app_version='3',
|
||||
max_app_version='3.*')
|
||||
|
@ -2347,7 +2342,7 @@ class TestCompatOverride(amo.tests.TestCase):
|
|||
# If the override ranges have different types they should be separate
|
||||
# entries.
|
||||
c = CompatOverride.objects.get(guid='one')
|
||||
CompatOverrideRange.objects.create(compat=c, app_id=1, type=0,
|
||||
CompatOverrideRange.objects.create(compat=c, app=1, type=0,
|
||||
min_app_version='3',
|
||||
max_app_version='3.*')
|
||||
r = c.collapsed_ranges()
|
||||
|
@ -2377,7 +2372,7 @@ class TestCompatOverride(amo.tests.TestCase):
|
|||
def test_collapsed_ranges_multiple_versions_and_apps(self):
|
||||
c = CompatOverride.objects.get(guid='two')
|
||||
CompatOverrideRange.objects.create(min_version='5', max_version='6',
|
||||
compat=c, app_id=1)
|
||||
compat=c, app=1)
|
||||
r = c.collapsed_ranges()
|
||||
|
||||
eq_(len(r), 2)
|
||||
|
@ -2395,14 +2390,14 @@ class TestCompatOverride(amo.tests.TestCase):
|
|||
class TestIncompatibleVersions(amo.tests.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.app = Application.objects.create(id=amo.FIREFOX.id)
|
||||
self.app = amo.APP_IDS[amo.FIREFOX.id]
|
||||
self.addon = Addon.objects.create(guid='r@b', type=amo.ADDON_EXTENSION)
|
||||
|
||||
def test_signals_min(self):
|
||||
eq_(IncompatibleVersions.objects.count(), 0)
|
||||
|
||||
c = CompatOverride.objects.create(guid='r@b')
|
||||
CompatOverrideRange.objects.create(compat=c, app=self.app,
|
||||
CompatOverrideRange.objects.create(compat=c, app=self.app.id,
|
||||
min_version='0',
|
||||
max_version='1.0')
|
||||
|
||||
|
@ -2429,7 +2424,7 @@ class TestIncompatibleVersions(amo.tests.TestCase):
|
|||
eq_(IncompatibleVersions.objects.count(), 0)
|
||||
|
||||
c = CompatOverride.objects.create(guid='r@b')
|
||||
CompatOverrideRange.objects.create(compat=c, app=self.app,
|
||||
CompatOverrideRange.objects.create(compat=c, app=self.app.id,
|
||||
min_version='1.0',
|
||||
max_version='*')
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from addons.search import extract
|
|||
|
||||
|
||||
class TestExtract(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
self.attrs = ('id', 'slug', 'app_slug', 'created', 'last_updated',
|
||||
|
|
|
@ -11,7 +11,7 @@ import amo.tests
|
|||
from addons.models import (Addon, CompatOverride, CompatOverrideRange,
|
||||
IncompatibleVersions)
|
||||
from amo.helpers import user_media_url
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from files.models import File
|
||||
from services import update
|
||||
from versions.models import ApplicationsVersions, Version
|
||||
|
@ -26,7 +26,7 @@ class VersionCheckMixin(object):
|
|||
|
||||
|
||||
class TestDataValidate(VersionCheckMixin, amo.tests.TestCase):
|
||||
fixtures = ['base/addon_3615', 'base/apps', 'base/appversion']
|
||||
fixtures = ['base/addon_3615', 'base/appversion']
|
||||
|
||||
def setUp(self):
|
||||
super(TestDataValidate, self).setUp()
|
||||
|
@ -94,7 +94,7 @@ class TestDataValidate(VersionCheckMixin, amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestLookup(VersionCheckMixin, amo.tests.TestCase):
|
||||
fixtures = ['addons/update', 'base/apps', 'base/appversion']
|
||||
fixtures = ['addons/update', 'base/appversion']
|
||||
|
||||
def setUp(self):
|
||||
super(TestLookup, self).setUp()
|
||||
|
@ -102,7 +102,7 @@ class TestLookup(VersionCheckMixin, amo.tests.TestCase):
|
|||
self.platform = None
|
||||
self.version_int = 3069900200100
|
||||
|
||||
self.app = Application.objects.get(id=1)
|
||||
self.app = amo.APP_IDS[1]
|
||||
self.version_1_0_2 = 66463
|
||||
self.version_1_1_3 = 90149
|
||||
self.version_1_2_0 = 105387
|
||||
|
@ -384,7 +384,7 @@ class TestDefaultToCompat(VersionCheckMixin, amo.tests.TestCase):
|
|||
super(TestDefaultToCompat, self).setUp()
|
||||
self.addon = Addon.objects.get(id=337203)
|
||||
self.platform = None
|
||||
self.app = Application.objects.get(id=1)
|
||||
self.app = amo.APP_IDS[1]
|
||||
self.app_version_int_3_0 = 3000000200100
|
||||
self.app_version_int_4_0 = 4000000200100
|
||||
self.app_version_int_5_0 = 5000000200100
|
||||
|
@ -419,7 +419,7 @@ class TestDefaultToCompat(VersionCheckMixin, amo.tests.TestCase):
|
|||
co = CompatOverride.objects.create(
|
||||
name='test', guid=self.addon.guid, addon=self.addon
|
||||
)
|
||||
default = dict(compat=co, app=self.app, min_version='0',
|
||||
default = dict(compat=co, app=self.app.id, min_version='0',
|
||||
max_version='*', min_app_version='0',
|
||||
max_app_version='*')
|
||||
default.update(kw)
|
||||
|
|
|
@ -71,7 +71,6 @@ def test_hovercards(self, doc, addons, src=''):
|
|||
|
||||
|
||||
class TestHomepage(amo.tests.TestCase):
|
||||
fixtures = ['base/apps']
|
||||
|
||||
def setUp(self):
|
||||
self.base_url = reverse('home')
|
||||
|
@ -96,8 +95,7 @@ class TestHomepage(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestHomepageFeatures(amo.tests.TestCase):
|
||||
fixtures = ['base/apps',
|
||||
'base/appversion',
|
||||
fixtures = ['base/appversion',
|
||||
'base/users',
|
||||
'base/addon_3615',
|
||||
'base/collections',
|
||||
|
@ -166,7 +164,7 @@ class TestPromobox(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestContributeInstalled(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/appversion', 'base/addon_592']
|
||||
fixtures = ['base/appversion', 'base/addon_592']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(pk=592)
|
||||
|
@ -339,7 +337,7 @@ class TestContributeEmbedded(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestDeveloperPages(amo.tests.TestCase):
|
||||
fixtures = ['base/addon_3615', 'base/addon_592', 'base/apps',
|
||||
fixtures = ['base/addon_3615', 'base/addon_592',
|
||||
'base/users', 'addons/eula+contrib-addon',
|
||||
'addons/addon_228106_info+dev+bio.json',
|
||||
'addons/addon_228107_multiple-devs.json']
|
||||
|
@ -483,8 +481,7 @@ class TestLicensePage(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestDetailPage(amo.tests.TestCase):
|
||||
fixtures = ['base/apps',
|
||||
'base/addon_3615',
|
||||
fixtures = ['base/addon_3615',
|
||||
'base/users',
|
||||
'base/addon_59',
|
||||
'base/addon_4594_a9',
|
||||
|
@ -823,7 +820,7 @@ class TestDetailPage(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestImpalaDetailPage(amo.tests.TestCase):
|
||||
fixtures = ['base/addon_3615', 'base/addon_592', 'base/apps', 'base/users']
|
||||
fixtures = ['base/addon_3615', 'base/addon_592', 'base/users']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=3615)
|
||||
|
@ -988,7 +985,7 @@ class TestImpalaDetailPage(amo.tests.TestCase):
|
|||
|
||||
def test_categories(self):
|
||||
c = self.addon.all_categories[0]
|
||||
c.application_id = amo.THUNDERBIRD.id
|
||||
c.application = amo.THUNDERBIRD.id
|
||||
c.save()
|
||||
links = self.get_more_pq()('#related ul:first').find('a')
|
||||
expected = [(unicode(c.name), c.get_url_path()) for c in
|
||||
|
@ -1185,7 +1182,7 @@ class TestEulaPolicyRedirects(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestEula(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'addons/eula+contrib-addon']
|
||||
fixtures = ['addons/eula+contrib-addon']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=11730)
|
||||
|
@ -1300,7 +1297,7 @@ class TestXssOnName(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestPrivacyPolicy(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'addons/eula+contrib-addon']
|
||||
fixtures = ['addons/eula+contrib-addon']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=11730)
|
||||
|
@ -1389,7 +1386,7 @@ class TestReportAbuse(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestMobile(amo.tests.MobileTest, amo.tests.TestCase):
|
||||
fixtures = ['addons/featured', 'base/apps', 'base/users',
|
||||
fixtures = ['addons/featured', 'base/users',
|
||||
'base/addon_3615', 'base/featured',
|
||||
'bandwagon/featured_collections']
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ def get_featured_ids(app, lang=None, type=None):
|
|||
from addons.models import Addon
|
||||
ids = []
|
||||
is_featured = (Q(collections__featuredcollection__isnull=False) &
|
||||
Q(collections__featuredcollection__application__id=app.id))
|
||||
Q(collections__featuredcollection__application=app.id))
|
||||
qs = Addon.objects.all()
|
||||
|
||||
if type:
|
||||
|
|
|
@ -116,7 +116,7 @@ def extension_detail(request, addon):
|
|||
|
||||
# Popular collections this addon is part of.
|
||||
collections = Collection.objects.listed().filter(
|
||||
addons=addon, application__id=request.APP.id)
|
||||
addons=addon, application=request.APP.id)
|
||||
|
||||
ctx = {
|
||||
'addon': addon,
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
[
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 418039,
|
||||
"model": "translations.translation",
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
[
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 60,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{a23983c0-fd0e-11dc-95ff-0800200c9a66}",
|
||||
"modified": "2008-10-28 18:25:09",
|
||||
"created": "2008-10-28 18:25:09"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 61,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{aa3c5121-dab2-40e2-81ca-7ea25febc110}",
|
||||
"modified": "2008-10-28 18:25:09",
|
||||
"created": "2008-10-28 18:25:09"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 59,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}",
|
||||
"modified": "2008-06-17 08:29:01",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 18,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{3550f703-e582-4d05-9a08-453d09bdfdc6}",
|
||||
"modified": "2006-08-21 23:53:19",
|
||||
"created": "2006-08-21 23:53:19"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 2,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{86c18b42-e466-45a9-ae7a-9b95ba6f5640}",
|
||||
"modified": "2006-08-21 23:53:19",
|
||||
"created": "2006-08-21 23:53:19"
|
||||
}
|
||||
}
|
||||
]
|
|
@ -1,13 +1,4 @@
|
|||
[
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 86,
|
||||
"model": "applications.appversion",
|
||||
|
|
|
@ -32,15 +32,6 @@
|
|||
"localized_string": "Extension"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1118,
|
||||
"model": "translations.translation",
|
||||
|
|
|
@ -24,15 +24,6 @@
|
|||
"notifyevents": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 906021,
|
||||
"model": "translations.translation",
|
||||
|
|
|
@ -10,15 +10,6 @@
|
|||
"id": 590910
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 15679,
|
||||
"model": "addons.addon",
|
||||
|
|
|
@ -133,24 +133,6 @@
|
|||
"size": 173056
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 59,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}",
|
||||
"modified": "2008-06-17 08:29:01",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 84,
|
||||
"model": "addons.feature",
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
[
|
||||
{
|
||||
"pk": 18,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{3550f703-e582-4d05-9a08-453d09bdfdc6}",
|
||||
"modified": "2008-06-17 08:29:00",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 298,
|
||||
"model": "applications.appversion",
|
||||
|
|
|
@ -44,7 +44,7 @@ from addons.models import (Addon, Persona,
|
|||
update_search_index as addon_update_search_index)
|
||||
from addons.tasks import unindex_addons
|
||||
from amo.urlresolvers import get_url_prefix, Prefixer, reverse, set_url_prefix
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from bandwagon.models import Collection
|
||||
from files.models import File
|
||||
from lib.es.signals import process, reset
|
||||
|
@ -633,7 +633,7 @@ def addon_factory(status=amo.STATUS_PUBLIC, version_kw={}, file_kw={}, **kw):
|
|||
def collection_factory(**kw):
|
||||
data = {
|
||||
'type': amo.COLLECTION_NORMAL,
|
||||
'application_id': amo.FIREFOX.id,
|
||||
'application': amo.FIREFOX.id,
|
||||
'name': 'Collection %s' % abs(hash(datetime.now())),
|
||||
'addon_count': random.randint(200, 2000),
|
||||
'subscribers': random.randint(1000, 5000),
|
||||
|
@ -702,13 +702,13 @@ def version_factory(file_kw={}, **kw):
|
|||
v.created = v.last_updated = _get_created(kw.pop('created', 'now'))
|
||||
v.save()
|
||||
if kw.get('addon').type != amo.ADDON_PERSONA:
|
||||
a, _ = Application.objects.get_or_create(id=amo.FIREFOX.id)
|
||||
av_min, _ = AppVersion.objects.get_or_create(application=a,
|
||||
av_min, _ = AppVersion.objects.get_or_create(application=amo.FIREFOX.id,
|
||||
version=min_app_version)
|
||||
av_max, _ = AppVersion.objects.get_or_create(application=a,
|
||||
av_max, _ = AppVersion.objects.get_or_create(application=amo.FIREFOX.id,
|
||||
version=max_app_version)
|
||||
ApplicationsVersions.objects.get_or_create(application=a, version=v,
|
||||
min=av_min, max=av_max)
|
||||
ApplicationsVersions.objects.get_or_create(application=amo.FIREFOX.id,
|
||||
version=v, min=av_min,
|
||||
max=av_max)
|
||||
file_factory(version=v, **file_kw)
|
||||
return v
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@ from addons.models import Addon
|
|||
|
||||
|
||||
class ManualOrderTest(TestCase):
|
||||
fixtures = ('base/apps', 'base/addon_3615', 'base/addon_5299_gcal',
|
||||
'base/addon_40')
|
||||
fixtures = ('base/addon_3615', 'base/addon_5299_gcal', 'base/addon_40')
|
||||
|
||||
def test_ordering(self):
|
||||
"""Given a specific set of primary keys, assure that we return addons
|
||||
|
|
|
@ -5,14 +5,12 @@ from nose.tools import eq_
|
|||
import amo
|
||||
import amo.tests
|
||||
from addons.models import Category
|
||||
from applications.models import Application
|
||||
|
||||
from django.db import connection
|
||||
|
||||
|
||||
class TestRedirects(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'reviews/test_models',
|
||||
'addons/persona', 'base/global-stats']
|
||||
fixtures = ['reviews/test_models', 'addons/persona', 'base/global-stats']
|
||||
|
||||
def test_persona_category(self):
|
||||
"""`/personas/film and tv` should go to /themes/film-and-tv"""
|
||||
|
@ -144,9 +142,8 @@ class TestRedirects(amo.tests.TestCase):
|
|||
self.assert3xx(r, '/en-US/firefox/extensions/',
|
||||
status_code=301)
|
||||
|
||||
a = Application.objects.create()
|
||||
Category.objects.create(pk=12, slug='woo', type=amo.ADDON_EXTENSION,
|
||||
application=a, count=1, weight=0)
|
||||
application=amo.FIREFOX.id, count=1, weight=0)
|
||||
r = self.client.get('/browse/type:1/cat:12?sort=averagerating',
|
||||
follow=True)
|
||||
url, code = r.redirect_chain[-1]
|
||||
|
|
|
@ -61,8 +61,7 @@ class Test404(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestCommon(amo.tests.TestCase):
|
||||
fixtures = ('base/users', 'base/global-stats', 'base/configs',
|
||||
'base/addon_3615')
|
||||
fixtures = ('base/users', 'base/global-stats', 'base/addon_3615')
|
||||
|
||||
def setUp(self):
|
||||
self.url = reverse('home')
|
||||
|
|
|
@ -314,7 +314,7 @@ class JSONEncoder(json.DjangoJSONEncoder):
|
|||
if isinstance(obj, unicodable):
|
||||
return unicode(obj)
|
||||
if isinstance(obj, ApplicationsVersions):
|
||||
return {unicode(obj.application): {'min': unicode(obj.min),
|
||||
return {unicode(amo.APP_IDS[obj.application].pretty): {'min': unicode(obj.min),
|
||||
'max': unicode(obj.max)}}
|
||||
|
||||
return super(JSONEncoder, self).default(obj)
|
||||
|
|
|
@ -46,13 +46,13 @@
|
|||
<compatible_applications>
|
||||
{%- if version -%}
|
||||
{%- for app in version.compatible_apps.values() %}
|
||||
{%- if amo.APP_IDS.get(app.application_id) -%}
|
||||
{%- if amo.APP_IDS.get(app.application) -%}
|
||||
<application>
|
||||
<name>{{ amo.APP_IDS[app.application_id].pretty }}</name>
|
||||
<application_id>{{ app.application_id }}</application_id>
|
||||
<name>{{ amo.APP_IDS[app.application].pretty }}</name>
|
||||
<application_id>{{ app.application }}</application_id>
|
||||
<min_version>{{ app.min }}</min_version>
|
||||
<max_version>{{ app.max }}</max_version>
|
||||
<appID>{{ amo.APP_IDS[app.application_id].guid }}</appID>
|
||||
<appID>{{ amo.APP_IDS[app.application].guid }}</appID>
|
||||
</application>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
|
|
|
@ -182,7 +182,7 @@ def get_access_token(consumer, token, authorize=True, verifier=None):
|
|||
|
||||
|
||||
class BaseOAuth(TestCase):
|
||||
fixtures = ['base/users', 'base/apps', 'base/appversion', 'base/licenses']
|
||||
fixtures = ['base/users', 'base/appversion', 'base/licenses']
|
||||
|
||||
def setUp(self):
|
||||
self.editor = UserProfile.objects.get(email='editor@mozilla.com')
|
||||
|
|
|
@ -22,7 +22,7 @@ from amo.urlresolvers import reverse
|
|||
from amo.views import handler500
|
||||
from api.utils import addon_to_dict
|
||||
from api.views import addon_filter
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from bandwagon.models import Collection, CollectionAddon, FeaturedCollection
|
||||
from files.models import File
|
||||
from files.tests.test_models import UploadTest
|
||||
|
@ -181,7 +181,7 @@ class StripHTMLTest(TestCase):
|
|||
|
||||
|
||||
class APITest(TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_3615', 'base/addon_4664_twitterbar',
|
||||
fixtures = ['base/addon_3615', 'base/addon_4664_twitterbar',
|
||||
'base/addon_5299_gcal', 'perf/index']
|
||||
|
||||
def test_api_caching(self):
|
||||
|
@ -506,9 +506,8 @@ class APITest(TestCase):
|
|||
c = CollectionAddon.objects.create(
|
||||
addon=Addon.objects.get(id=5299),
|
||||
collection=Collection.objects.create())
|
||||
FeaturedCollection.objects.create(locale='ja',
|
||||
application=Application.objects.get(id=amo.FIREFOX.id),
|
||||
collection=c.collection)
|
||||
FeaturedCollection.objects.create(
|
||||
locale='ja', application=amo.FIREFOX.id, collection=c.collection)
|
||||
for lang, app, result in [('ja', 'firefox', 1),
|
||||
('en-US', 'firefox', 0),
|
||||
('ja', 'seamonkey', 0)]:
|
||||
|
@ -594,7 +593,7 @@ class DRFAPITest(DRFMixin, APITest):
|
|||
|
||||
class ListTest(TestCase):
|
||||
"""Tests the list view with various urls."""
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615', 'base/featured',
|
||||
fixtures = ['base/users', 'base/addon_3615', 'base/featured',
|
||||
'addons/featured', 'bandwagon/featured_collections',
|
||||
'base/collections']
|
||||
|
||||
|
@ -694,7 +693,7 @@ class DRFListTest(DRFMixin, ListTest):
|
|||
|
||||
class AddonFilterTest(TestCase):
|
||||
"""Tests the addon_filter, including the various d2c cases."""
|
||||
fixtures = ['base/apps', 'base/appversion']
|
||||
fixtures = ['base/appversion']
|
||||
|
||||
def setUp(self):
|
||||
# Start with 2 compatible add-ons.
|
||||
|
@ -784,7 +783,7 @@ class AddonFilterTest(TestCase):
|
|||
# Add override for this add-on.
|
||||
compat = CompatOverride.objects.create(guid='three', addon=addon3)
|
||||
CompatOverrideRange.objects.create(
|
||||
compat=compat, app=Application.objects.get(pk=1),
|
||||
compat=compat, app=1,
|
||||
min_version=addon3.current_version.version, max_version='*')
|
||||
|
||||
addons = addon_filter(**self._defaults(addons=addons, version='11.0',
|
||||
|
@ -818,7 +817,7 @@ class SeamonkeyFeaturedTest(TestCase):
|
|||
|
||||
|
||||
class TestGuidSearch(TestCase):
|
||||
fixtures = ('base/apps', 'base/addon_6113', 'base/addon_3615')
|
||||
fixtures = ('base/addon_6113', 'base/addon_3615')
|
||||
# These are the guids for addon 6113 and 3615.
|
||||
good = ('search/guid:{22870005-adef-4c9d-ae36-d0e1f2f27e5a},'
|
||||
'{2fa4ed95-0317-4c6a-a74c-5f3e3912c1f9}')
|
||||
|
@ -827,7 +826,7 @@ class TestGuidSearch(TestCase):
|
|||
addon = Addon.objects.get(id=3615)
|
||||
c = CompatOverride.objects.create(guid=addon.guid)
|
||||
app = addon.compatible_apps.keys()[0]
|
||||
CompatOverrideRange.objects.create(compat=c, app_id=app.id)
|
||||
CompatOverrideRange.objects.create(compat=c, app=app.id)
|
||||
|
||||
def test_success(self):
|
||||
r = make_call(self.good)
|
||||
|
@ -900,7 +899,7 @@ class TestGuidSearch(TestCase):
|
|||
|
||||
def test_addon_compatibility_not_hosted(self):
|
||||
c = CompatOverride.objects.create(guid='yeah', name='ok')
|
||||
CompatOverrideRange.objects.create(app_id=1, compat=c,
|
||||
CompatOverrideRange.objects.create(app=1, compat=c,
|
||||
min_version='1', max_version='2',
|
||||
min_app_version='3',
|
||||
max_app_version='4')
|
||||
|
@ -926,7 +925,7 @@ class TestGuidSearch(TestCase):
|
|||
|
||||
|
||||
class SearchTest(ESTestCase):
|
||||
fixtures = ('base/apps', 'base/appversion',
|
||||
fixtures = ('base/appversion',
|
||||
'base/addon_6113', 'base/addon_40', 'base/addon_3615',
|
||||
'base/addon_6704_grapple', 'base/addon_4664_twitterbar',
|
||||
'base/addon_10423_youtubesearch', 'base/featured')
|
||||
|
@ -1154,11 +1153,10 @@ class SearchTest(ESTestCase):
|
|||
def test_compat_mode_normal_max_version(self):
|
||||
# We ignore versions that don't qualify for d2c by not having the
|
||||
# minimum maxVersion support (e.g. Firefox >= 4.0).
|
||||
app = Application.objects.get(id=1)
|
||||
fx30 = AppVersion.objects.get(application=app, version="3.0")
|
||||
fx35 = AppVersion.objects.get(application=app, version="3.5")
|
||||
fx30 = AppVersion.objects.get(application=1, version="3.0")
|
||||
fx35 = AppVersion.objects.get(application=1, version="3.5")
|
||||
addon = Addon.objects.get(pk=3615)
|
||||
av = addon.current_version.apps.filter(application=app)[0]
|
||||
av = addon.current_version.apps.filter(application=1)[0]
|
||||
av.min = fx30
|
||||
av.max = fx35
|
||||
av.save()
|
||||
|
@ -1192,10 +1190,9 @@ class SearchTest(ESTestCase):
|
|||
self.assertContains(response, 'Delicious Bookmarks')
|
||||
|
||||
# Make add-on have a compat override.
|
||||
app = Application.objects.get(id=1)
|
||||
co = CompatOverride.objects.create(name='test', guid=addon.guid,
|
||||
addon=addon)
|
||||
CompatOverrideRange.objects.create(compat=co, app=app,
|
||||
CompatOverrideRange.objects.create(compat=co, app=1,
|
||||
min_version='0',
|
||||
max_version='*',
|
||||
min_app_version='0',
|
||||
|
@ -1272,7 +1269,7 @@ class DRFSearchTest(DRFMixin, SearchTest):
|
|||
|
||||
|
||||
class LanguagePacks(UploadTest):
|
||||
fixtures = ['addons/listed', 'base/apps']
|
||||
fixtures = ['addons/listed']
|
||||
|
||||
def setUp(self):
|
||||
self.url = reverse('api.language', args=['1.5'])
|
||||
|
@ -1293,7 +1290,7 @@ class LanguagePacks(UploadTest):
|
|||
|
||||
def test_search_app(self):
|
||||
self.addon.update(type=amo.ADDON_LPAPP, status=amo.STATUS_PUBLIC)
|
||||
AppSupport.objects.create(addon=self.addon, app_id=amo.THUNDERBIRD.id)
|
||||
AppSupport.objects.create(addon=self.addon, app=amo.THUNDERBIRD.id)
|
||||
res = self.client.get(self.tb_url)
|
||||
self.assertContains(res, "<guid>{835A3F80-DF39")
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ def extract_from_query(term, filter, regexp, end_of_word_boundary=True):
|
|||
return (term, value)
|
||||
|
||||
|
||||
def extract_filters(term, app_id=amo.FIREFOX.id, opts=None):
|
||||
def extract_filters(term, opts=None):
|
||||
"""
|
||||
Pulls all the filtering options out of the term and returns a cleaned term
|
||||
and a dictionary of filter names and filter values. Term filters override
|
||||
|
@ -139,15 +139,6 @@ def extract_filters(term, app_id=amo.FIREFOX.id, opts=None):
|
|||
term, version = extract_from_query(term, 'version', '[0-9.]+')
|
||||
params['version'] = version or opts.get('version')
|
||||
|
||||
# Category filters.
|
||||
term, category = extract_from_query(term, 'category', '\w+')
|
||||
if category and 'app' in opts:
|
||||
category = (Category.objects.filter(slug__istartswith=category,
|
||||
application=opts['app'])
|
||||
.values_list('id', flat=True))
|
||||
if category:
|
||||
filters['category'] = category[0]
|
||||
|
||||
# Tag filters.
|
||||
term, tag = extract_from_query(term, 'tag', '\w+')
|
||||
if tag:
|
||||
|
|
|
@ -353,8 +353,7 @@ class SearchView(APIView):
|
|||
# This fails if the string is already UTF-8.
|
||||
pass
|
||||
|
||||
query, qs_filters, params = extract_filters(query, filters['app'],
|
||||
opts)
|
||||
query, qs_filters, params = extract_filters(query, opts)
|
||||
|
||||
qs = Addon.search().query(or_=name_query(query))
|
||||
filters.update(qs_filters)
|
||||
|
|
|
@ -200,8 +200,7 @@ class SearchView(DRFView):
|
|||
# This fails if the string is already UTF-8.
|
||||
pass
|
||||
|
||||
query, qs_filters, params = extract_filters(query, filters['app'],
|
||||
opts)
|
||||
query, qs_filters, params = extract_filters(query, opts)
|
||||
|
||||
qs = Addon.search().query(or_=name_query(query))
|
||||
filters.update(qs_filters)
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
[
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 2,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{86c18b42-e466-45a9-ae7a-9b95ba6f5640}",
|
||||
"modified": "2008-11-03 15:35:00",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 18,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{3550f703-e582-4d05-9a08-453d09bdfdc6}",
|
||||
"modified": "2008-06-17 08:29:00",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 59,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}",
|
||||
"modified": "2008-06-17 08:29:01",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 60,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{a23983c0-fd0e-11dc-95ff-0800200c9a66}",
|
||||
"modified": "2008-10-28 18:25:09",
|
||||
"created": "2008-10-28 18:25:09"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 61,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{aa3c5121-dab2-40e2-81ca-7ea25febc110}",
|
||||
"modified": "2008-10-28 18:25:09",
|
||||
"created": "2008-10-28 18:25:09"
|
||||
}
|
||||
}
|
||||
]
|
|
@ -8,7 +8,7 @@ from applications.models import AppVersion
|
|||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = ('Add a new version to a Application. Syntax: \n'
|
||||
help = ('Add a new version of an application. Syntax: \n'
|
||||
' ./manage.py addnewversion <application_name> <version>')
|
||||
log = commonware.log.getLogger('z.appversions')
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ from django.core.management.base import BaseCommand
|
|||
from django.core.files.storage import default_storage as storage
|
||||
import commonware.log
|
||||
import amo
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
|
||||
log = commonware.log.getLogger('z.cron')
|
||||
|
||||
|
@ -20,9 +20,8 @@ class Command(BaseCommand):
|
|||
|
||||
def handle(self, *args, **kw):
|
||||
apps = {}
|
||||
for id, guid in (Application.objects
|
||||
.supported().values_list('id', 'guid')):
|
||||
apps[id] = dict(guid=guid, versions=[],
|
||||
for id, app in amo.APP_IDS.iteritems():
|
||||
apps[id] = dict(guid=app.guid, versions=[],
|
||||
name=amo.APPS_ALL[id].short)
|
||||
versions = (AppVersion.objects.values_list('application', 'version')
|
||||
.order_by('version_int'))
|
||||
|
|
|
@ -30,7 +30,7 @@ class Application(amo.models.ModelBase):
|
|||
|
||||
class AppVersion(amo.models.ModelBase):
|
||||
|
||||
application = models.ForeignKey(Application)
|
||||
application = models.PositiveIntegerField(db_column='application_id')
|
||||
version = models.CharField(max_length=255, default='')
|
||||
version_int = models.BigIntegerField(editable=False)
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from nose.tools import eq_
|
|||
import amo
|
||||
import amo.tests
|
||||
from amo.helpers import url
|
||||
from applications.models import AppVersion, Application
|
||||
from applications.models import AppVersion
|
||||
from applications.management.commands import dump_apps
|
||||
|
||||
|
||||
|
@ -39,39 +39,14 @@ class TestAppVersion(amo.tests.TestCase):
|
|||
|
||||
def test_unique_together_application_version(self):
|
||||
"""Check that one can't add duplicate application-version pairs."""
|
||||
app = Application.objects.create(guid='foobar')
|
||||
AppVersion.objects.create(application=app, version='123')
|
||||
AppVersion.objects.create(application=1, version='123')
|
||||
|
||||
with self.assertRaises(IntegrityError):
|
||||
AppVersion.objects.create(application=app, version='123')
|
||||
|
||||
|
||||
class TestApplication(amo.tests.TestCase):
|
||||
fixtures = ['applications/all_apps.json']
|
||||
|
||||
def test_string_representation(self):
|
||||
"""
|
||||
Check that the string representation of the app model instances
|
||||
matches out constants
|
||||
"""
|
||||
for static_app in amo.APP_USAGE:
|
||||
model_app = Application.objects.get(id=static_app.id)
|
||||
eq_(unicode(model_app), unicode(static_app.pretty))
|
||||
|
||||
|
||||
class TestApplicationManager(amo.tests.TestCase):
|
||||
fixtures = ['applications/all_apps.json']
|
||||
|
||||
def test_default_manager(self):
|
||||
eq_(Application.objects.count(), 6)
|
||||
|
||||
def test_supported(self):
|
||||
Application.objects.latest('pk').update(supported=False)
|
||||
eq_(Application.objects.supported().count(), 5)
|
||||
AppVersion.objects.create(application=1, version='123')
|
||||
|
||||
|
||||
class TestViews(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/appversion']
|
||||
fixtures = ['base/appversion']
|
||||
|
||||
def test_appversions(self):
|
||||
eq_(self.client.get(url('apps.appversions')).status_code, 200)
|
||||
|
@ -81,20 +56,17 @@ class TestViews(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestCommands(amo.tests.TestCase):
|
||||
fixtures = ['applications/all_apps.json', 'base/apps', 'base/appversion']
|
||||
fixtures = ['base/appversion']
|
||||
|
||||
def test_dump_apps(self):
|
||||
call_command('dump_apps')
|
||||
with open(dump_apps.Command.JSON_PATH, 'r') as f:
|
||||
apps = json.load(f)
|
||||
db_apps = Application.objects.all()
|
||||
assert len(db_apps)
|
||||
for app in db_apps:
|
||||
for idx, app in amo.APP_IDS.iteritems():
|
||||
data = apps[str(app.id)]
|
||||
versions = sorted([a.version for a in
|
||||
AppVersion.objects.filter(application=app)])
|
||||
r_app = amo.APPS_ALL[app.id]
|
||||
eq_("%s: %r" % (r_app.short, sorted(data['versions'])),
|
||||
"%s: %r" % (r_app.short, versions))
|
||||
eq_(data['name'], r_app.short)
|
||||
AppVersion.objects.filter(application=app.id)])
|
||||
eq_("%s: %r" % (app.short, sorted(data['versions'])),
|
||||
"%s: %r" % (app.short, versions))
|
||||
eq_(data['name'], app.short)
|
||||
eq_(data['guid'], app.guid)
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
[
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 434742,
|
||||
"model": "translations.translation",
|
||||
|
|
|
@ -35,7 +35,7 @@ class AdminForm(Form):
|
|||
|
||||
def save(self, collection):
|
||||
collection.type = self.cleaned_data['type']
|
||||
collection.application_id = self.cleaned_data['application']
|
||||
collection.application = self.cleaned_data['application']
|
||||
collection.save()
|
||||
|
||||
|
||||
|
@ -188,7 +188,7 @@ class CollectionForm(ModelForm):
|
|||
def save(self, default_locale=None):
|
||||
c = super(CollectionForm, self).save(commit=False)
|
||||
c.author = self.initial['author']
|
||||
c.application_id = self.initial['application_id']
|
||||
c.application = self.initial['application']
|
||||
icon = self.cleaned_data.get('icon')
|
||||
|
||||
if default_locale:
|
||||
|
|
|
@ -20,7 +20,6 @@ from addons.models import Addon, AddonRecommendation
|
|||
from amo.helpers import absolutify, user_media_path, user_media_url
|
||||
from amo.urlresolvers import reverse
|
||||
from amo.utils import sorted_groupby
|
||||
from applications.models import Application
|
||||
from stats.models import CollectionShareCountTotal
|
||||
from translations.fields import (LinkifiedField, save_signal,
|
||||
NoLinksNoMarkupField, TranslatedField)
|
||||
|
@ -120,7 +119,8 @@ class Collection(CollectionBase, amo.models.ModelBase):
|
|||
downloads = models.PositiveIntegerField(default=0)
|
||||
weekly_subscribers = models.PositiveIntegerField(default=0)
|
||||
monthly_subscribers = models.PositiveIntegerField(default=0)
|
||||
application = models.ForeignKey(Application, null=True)
|
||||
application = models.PositiveIntegerField(db_column='application_id',
|
||||
null=True)
|
||||
addon_count = models.PositiveIntegerField(default=0,
|
||||
db_column='addonCount')
|
||||
|
||||
|
@ -587,7 +587,7 @@ class RecommendedCollection(Collection):
|
|||
|
||||
|
||||
class FeaturedCollection(amo.models.ModelBase):
|
||||
application = models.ForeignKey(Application)
|
||||
application = models.PositiveIntegerField(db_column='application_id')
|
||||
collection = models.ForeignKey(Collection)
|
||||
locale = models.CharField(max_length=10, null=True)
|
||||
|
||||
|
|
|
@ -8,9 +8,9 @@ import amo
|
|||
def extract(collection):
|
||||
attrs = ('id', 'created', 'modified', 'slug', 'author_username',
|
||||
'subscribers', 'weekly_subscribers', 'monthly_subscribers',
|
||||
'rating', 'listed', 'type', 'application_id')
|
||||
'rating', 'listed', 'type', 'application')
|
||||
d = dict(zip(attrs, attrgetter(*attrs)(collection)))
|
||||
d['app'] = d.pop('application_id')
|
||||
d['app'] = d.pop('application')
|
||||
d['name_sort'] = unicode(collection.name).lower()
|
||||
translations = collection.translations
|
||||
d['name'] = list(set(string for _, string
|
||||
|
|
|
@ -348,8 +348,7 @@ class TestVotes(amo.tests.TestCase):
|
|||
|
||||
class TestCRUD(amo.tests.TestCase):
|
||||
"""Test the collection form."""
|
||||
fixtures = ('base/apps', 'base/users', 'base/addon_3615',
|
||||
'base/collections')
|
||||
fixtures = ('base/users', 'base/addon_3615', 'base/collections')
|
||||
|
||||
def setUp(self):
|
||||
self.client = HappyUnicodeClient()
|
||||
|
@ -663,7 +662,7 @@ class TestCRUD(amo.tests.TestCase):
|
|||
url = reverse('collections.edit_contributors',
|
||||
args=['admin', self.slug])
|
||||
r = self.client.post(url, {'contributor': 999,
|
||||
'application_id': 1,
|
||||
'application': 1,
|
||||
'type': 1},
|
||||
follow=True)
|
||||
doc = pq(r.content)('.success')
|
||||
|
@ -764,7 +763,7 @@ class TestCRUD(amo.tests.TestCase):
|
|||
url = reverse('collections.edit_contributors',
|
||||
args=['admin', self.slug])
|
||||
self.client.post(url,
|
||||
{'contributor': 999, 'application_id': 1, 'type': 1},
|
||||
{'contributor': 999, 'application': 1, 'type': 1},
|
||||
follow=True)
|
||||
url = reverse('collections.edit', args=['admin', self.slug])
|
||||
|
||||
|
@ -921,7 +920,7 @@ class TestChangeAddon(amo.tests.TestCase):
|
|||
|
||||
|
||||
class AjaxTest(amo.tests.TestCase):
|
||||
fixtures = ('base/apps', 'base/users', 'base/addon_3615',
|
||||
fixtures = ('base/users', 'base/addon_3615',
|
||||
'base/addon_5299_gcal', 'base/collections')
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1058,7 +1057,7 @@ class TestCollectionFeed(TestFeeds):
|
|||
|
||||
|
||||
class TestCollectionListing(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615', 'base/category',
|
||||
fixtures = ['base/users', 'base/addon_3615', 'base/category',
|
||||
'base/featured', 'addons/featured', 'addons/listed',
|
||||
'base/collections', 'bandwagon/featured_collections']
|
||||
|
||||
|
@ -1224,7 +1223,7 @@ class TestCollectionForm(amo.tests.TestCase):
|
|||
instance=collection,
|
||||
files={'icon': get_uploaded_file('transparent.png')},
|
||||
initial={'author': collection.author,
|
||||
'application_id': collection.application.pk})
|
||||
'application': collection.application})
|
||||
assert form.is_valid()
|
||||
form.save()
|
||||
assert update_mock.called
|
||||
|
|
|
@ -294,7 +294,7 @@ def collection_vote(request, username, slug, direction):
|
|||
|
||||
|
||||
def initial_data_from_request(request):
|
||||
return dict(author=request.amo_user, application_id=request.APP.id)
|
||||
return dict(author=request.amo_user, application=request.APP.id)
|
||||
|
||||
|
||||
def collection_message(request, collection, option):
|
||||
|
@ -346,7 +346,7 @@ def add(request):
|
|||
def ajax_new(request):
|
||||
form = forms.CollectionForm(request.POST or None,
|
||||
initial={'author': request.amo_user,
|
||||
'application_id': request.APP.id},
|
||||
'application': request.APP.id},
|
||||
)
|
||||
|
||||
if request.method == 'POST' and form.is_valid():
|
||||
|
@ -448,7 +448,7 @@ def edit(request, collection, username, slug):
|
|||
|
||||
if is_admin:
|
||||
initial = dict(type=collection.type,
|
||||
application=collection.application_id)
|
||||
application=collection.application)
|
||||
admin_form = forms.AdminForm(initial=initial)
|
||||
else:
|
||||
admin_form = None
|
||||
|
|
|
@ -10,15 +10,6 @@
|
|||
"localized_string": "Walloon Language Pack"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 267,
|
||||
"model": "applications.appversion",
|
||||
|
|
|
@ -23,7 +23,6 @@ from amo.helpers import absolutify, numberfmt, urlparams
|
|||
from addons.tests.test_views import TestMobile
|
||||
from addons.models import (Addon, AddonCategory, Category, AppSupport, Feature,
|
||||
FrozenAddon, Persona)
|
||||
from applications.models import Application
|
||||
from bandwagon.models import Collection, CollectionAddon, FeaturedCollection
|
||||
from browse import feeds
|
||||
from browse.views import (AddonFilter, locale_display_name,
|
||||
|
@ -127,7 +126,7 @@ class TestESExtensions(ExtensionTestCase):
|
|||
# Stick one add-on in a category, make sure search finds it.
|
||||
addon = Addon.objects.filter(status=amo.STATUS_PUBLIC,
|
||||
disabled_by_user=False)[0]
|
||||
c = Category.objects.create(application_id=amo.FIREFOX.id,
|
||||
c = Category.objects.create(application=amo.FIREFOX.id,
|
||||
slug='alerts', type=addon.type)
|
||||
AddonCategory.objects.create(category=c, addon=addon)
|
||||
addon.save()
|
||||
|
@ -159,7 +158,7 @@ def test_locale_display_name():
|
|||
|
||||
|
||||
class TestListing(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/appversion', 'base/users', 'base/category',
|
||||
fixtures = ['base/appversion', 'base/users', 'base/category',
|
||||
'base/featured', 'addons/featured', 'addons/listed',
|
||||
'base/collections', 'bandwagon/featured_collections',
|
||||
'base/addon_3615']
|
||||
|
@ -394,7 +393,7 @@ class TestThemes(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestFeeds(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/appversion', 'base/users', 'base/category',
|
||||
fixtures = ['base/appversion', 'base/users', 'base/category',
|
||||
'base/featured', 'addons/featured', 'addons/listed',
|
||||
'base/collections', 'bandwagon/featured_collections',
|
||||
'base/addon_3615']
|
||||
|
@ -486,7 +485,7 @@ class TestFeeds(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestFeaturedLocale(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/appversion', 'base/category', 'base/users',
|
||||
fixtures = ['base/appversion', 'base/category', 'base/users',
|
||||
'base/addon_3615', 'base/featured', 'addons/featured',
|
||||
'browse/nameless-addon', 'base/collections',
|
||||
'bandwagon/featured_collections',
|
||||
|
@ -654,7 +653,7 @@ class TestFeaturedLocale(amo.tests.TestCase):
|
|||
for pk in [1003, 3481]:
|
||||
addon = Addon.objects.get(pk=pk)
|
||||
addon.update(status=amo.STATUS_PUBLIC)
|
||||
addon.appsupport_set.create(app_id=1)
|
||||
addon.appsupport_set.create(app=1)
|
||||
|
||||
# Note 1003 and 3481 are now en-US.
|
||||
# And 7661 and 2464 are now None.
|
||||
|
@ -695,7 +694,7 @@ class TestFeaturedLocale(amo.tests.TestCase):
|
|||
def test_featured_duplicated(self):
|
||||
another = Addon.objects.get(id=1003)
|
||||
self.change_addon(another, 'en-US')
|
||||
another.feature_set.create(application_id=amo.FIREFOX.id,
|
||||
another.feature_set.create(application=amo.FIREFOX.id,
|
||||
locale=None,
|
||||
start=datetime.today(),
|
||||
end=datetime.today())
|
||||
|
@ -704,7 +703,7 @@ class TestFeaturedLocale(amo.tests.TestCase):
|
|||
def change_addon(self, addon, locale='es'):
|
||||
fc = FeaturedCollection.objects.filter(collection__addons=addon.id)[0]
|
||||
feature = FeaturedCollection.objects.create(locale=locale,
|
||||
application=Application.objects.get(id=amo.FIREFOX.id),
|
||||
application=amo.FIREFOX.id,
|
||||
collection=Collection.objects.create())
|
||||
c = CollectionAddon.objects.filter(addon=addon,
|
||||
collection=fc.collection)[0]
|
||||
|
@ -719,13 +718,13 @@ class TestFeaturedLocale(amo.tests.TestCase):
|
|||
c = CollectionAddon.objects.create(addon=addon,
|
||||
collection=Collection.objects.create())
|
||||
FeaturedCollection.objects.create(locale=locale,
|
||||
application=Application.objects.get(id=amo.FIREFOX.id),
|
||||
application=amo.FIREFOX.id,
|
||||
collection=c.collection)
|
||||
self.reset()
|
||||
|
||||
|
||||
class TestListingByStatus(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_3615']
|
||||
fixtures = ['base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=3615)
|
||||
|
@ -787,7 +786,7 @@ class TestListingByStatus(amo.tests.TestCase):
|
|||
|
||||
|
||||
class BaseSearchToolsTest(amo.tests.TestCase):
|
||||
fixtures = ('base/apps', 'base/appversion', 'base/featured',
|
||||
fixtures = ('base/appversion', 'base/featured',
|
||||
'addons/featured', 'base/category', 'addons/listed')
|
||||
|
||||
def setUp(self):
|
||||
|
@ -818,7 +817,7 @@ class BaseSearchToolsTest(amo.tests.TestCase):
|
|||
|
||||
# Feature foxy :
|
||||
foxy = Addon.objects.get(name__localized_string='FoxyProxy Standard')
|
||||
Feature(addon=foxy, application_id=amo.FIREFOX.id,
|
||||
Feature(addon=foxy, application=amo.FIREFOX.id,
|
||||
start=datetime.now(),
|
||||
end=datetime.now() + timedelta(days=30)).save()
|
||||
|
||||
|
@ -1144,7 +1143,7 @@ class TestCategoriesFeed(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestFeaturedFeed(amo.tests.TestCase):
|
||||
fixtures = ['addons/featured', 'base/addon_3615', 'base/apps',
|
||||
fixtures = ['addons/featured', 'base/addon_3615',
|
||||
'base/appversion', 'base/appversion', 'base/collections',
|
||||
'base/featured', 'base/users',
|
||||
'bandwagon/featured_collections']
|
||||
|
@ -1164,7 +1163,7 @@ class TestFeaturedFeed(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestPersonas(amo.tests.TestCase):
|
||||
fixtures = ('base/apps', 'base/appversion', 'base/featured',
|
||||
fixtures = ('base/appversion', 'base/featured',
|
||||
'addons/featured', 'addons/persona')
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1223,7 +1222,7 @@ class TestPersonas(amo.tests.TestCase):
|
|||
# Whatever the `category.count` is.
|
||||
category = Category(type=amo.ADDON_PERSONA, slug='abc',
|
||||
count=MIN_COUNT_FOR_LANDING + 1,
|
||||
application=Application.objects.get(id=amo.FIREFOX.id))
|
||||
application=amo.FIREFOX.id)
|
||||
category.save()
|
||||
r = self.client.get(self.landing_url)
|
||||
self.assertTemplateUsed(r, self.landing_template)
|
||||
|
@ -1231,7 +1230,7 @@ class TestPersonas(amo.tests.TestCase):
|
|||
def test_personas_grid_sorting(self):
|
||||
"""Ensure we hit a grid page if there is a sorting."""
|
||||
category = Category(type=amo.ADDON_PERSONA, slug='abc',
|
||||
application=Application.objects.get(id=amo.FIREFOX.id))
|
||||
application=amo.FIREFOX.id)
|
||||
category.save()
|
||||
category_url = reverse('browse.personas', args=[category.slug])
|
||||
r = self.client.get(category_url + '?sort=created')
|
||||
|
@ -1405,7 +1404,7 @@ class TestMobilePersonas(TestMobile):
|
|||
|
||||
def _create_persona_cat(self):
|
||||
category = Category(type=amo.ADDON_PERSONA, slug='xxx',
|
||||
application_id=amo.FIREFOX.id)
|
||||
application=amo.FIREFOX.id)
|
||||
category.save()
|
||||
return category
|
||||
|
||||
|
|
|
@ -192,6 +192,7 @@ APPS_ALL = dict((app.id, app) for app in _apps + (MOZILLA, SUNBIRD))
|
|||
APP_IDS = dict((app.id, app) for app in _apps)
|
||||
APP_GUIDS = dict((app.guid, app) for app in _apps)
|
||||
APPS_RETIRED = dict([(MOZILLA.short, MOZILLA), (SUNBIRD.short, SUNBIRD)])
|
||||
APPS_CHOICES = tuple((app.id, app.pretty) for app in _apps)
|
||||
|
||||
APP_TYPE_SUPPORT = {}
|
||||
for _app in APP_USAGE:
|
||||
|
|
|
@ -161,15 +161,6 @@
|
|||
"created": "2010-01-02 12:34:56"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 112349,
|
||||
"model": "files.file",
|
||||
|
|
|
@ -27,7 +27,7 @@ from amo.forms import AMOModelForm
|
|||
from amo.urlresolvers import reverse
|
||||
from amo.utils import raise_required, slugify
|
||||
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from files.models import File, FileUpload
|
||||
from files.utils import parse_addon, VERSION_RE
|
||||
from translations.widgets import TranslationTextarea, TranslationTextInput
|
||||
|
@ -401,12 +401,6 @@ class VersionForm(WithSourceMixin, happyforms.ModelForm):
|
|||
fields = ('releasenotes', 'approvalnotes', 'source')
|
||||
|
||||
|
||||
class ApplicationChoiceField(forms.ModelChoiceField):
|
||||
|
||||
def label_from_instance(self, obj):
|
||||
return obj.id
|
||||
|
||||
|
||||
class AppVersionChoiceField(forms.ModelChoiceField):
|
||||
|
||||
def label_from_instance(self, obj):
|
||||
|
@ -414,8 +408,7 @@ class AppVersionChoiceField(forms.ModelChoiceField):
|
|||
|
||||
|
||||
class CompatForm(happyforms.ModelForm):
|
||||
application = ApplicationChoiceField(Application.objects.all(),
|
||||
widget=forms.HiddenInput)
|
||||
application = forms.ChoiceField(amo.APPS_CHOICES, widget=forms.HiddenInput)
|
||||
min = AppVersionChoiceField(AppVersion.objects.none())
|
||||
max = AppVersionChoiceField(AppVersion.objects.none())
|
||||
|
||||
|
@ -959,12 +952,12 @@ class CheckCompatibilityForm(happyforms.Form):
|
|||
w.attrs['data-url'] = reverse('devhub.compat_application_versions')
|
||||
|
||||
def version_choices_for_app_id(self, app_id):
|
||||
versions = AppVersion.objects.filter(application__id=app_id)
|
||||
versions = AppVersion.objects.filter(application=app_id)
|
||||
return [(v.id, v.version) for v in versions]
|
||||
|
||||
def clean_application(self):
|
||||
app_id = int(self.cleaned_data['application'])
|
||||
app = Application.objects.get(pk=app_id)
|
||||
app = amo.APPS_IDS.get(app_id)
|
||||
self.cleaned_data['application'] = app
|
||||
choices = self.version_choices_for_app_id(app_id)
|
||||
self.fields['app_version'].choices = choices
|
||||
|
|
|
@ -22,7 +22,7 @@ from amo.decorators import write, set_modified_on
|
|||
from amo.utils import resize_image, send_html_mail_jinja
|
||||
from addons.models import Addon
|
||||
from applications.management.commands import dump_apps
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from devhub import perf
|
||||
from files.helpers import copyfileobj
|
||||
from files.models import FileUpload, File, FileValidation
|
||||
|
@ -60,8 +60,8 @@ def compatibility_check(upload_id, app_guid, appversion_str, **kw):
|
|||
log.info('COMPAT CHECK for upload %s / app %s version %s'
|
||||
% (upload_id, app_guid, appversion_str))
|
||||
upload = FileUpload.objects.get(pk=upload_id)
|
||||
app = Application.objects.get(guid=app_guid)
|
||||
appver = AppVersion.objects.get(application=app, version=appversion_str)
|
||||
app = amo.APP_GUIDS.get(app_guid)
|
||||
appver = AppVersion.objects.get(application=app.id, version=appversion_str)
|
||||
try:
|
||||
result = run_validator(upload.path,
|
||||
for_appversions={app_guid: [appversion_str]},
|
||||
|
@ -74,7 +74,7 @@ def compatibility_check(upload_id, app_guid, appversion_str, **kw):
|
|||
{app_guid: appversion_str}},
|
||||
compat=True)
|
||||
upload.validation = result
|
||||
upload.compat_with_app = app
|
||||
upload.compat_with_app = app.id
|
||||
upload.compat_with_appver = appver
|
||||
upload.save() # We want to hit the custom save().
|
||||
except:
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
{% if result_type == 'compat' %}
|
||||
<tr>
|
||||
<th>{{ _('Tested for compatibility against:') }}</th>
|
||||
<td>{{ amo.APP_IDS[target_app.pk].pretty }} {{ target_version }}</td>
|
||||
<td>{{ amo.APP_IDS[target_app].pretty }} {{ target_version }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
</table>
|
||||
|
@ -34,7 +34,7 @@
|
|||
{% if result_type == 'compat' %}
|
||||
{% with app_trans=app_trans,
|
||||
version_change_links=version_change_links,
|
||||
target_version={target_app.guid: target_version.version} %}
|
||||
target_version={amo.APP_IDS[target_app].guid: target_version.version} %}
|
||||
{% include "devhub/addons/includes/validation_compat_test_results.html" %}
|
||||
{% endwith %}
|
||||
{% else %}
|
||||
|
|
|
@ -85,13 +85,13 @@ class TestCharityForm(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestCompatForm(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_3615']
|
||||
fixtures = ['base/addon_3615']
|
||||
|
||||
def test_mozilla_app(self):
|
||||
moz = amo.MOZILLA
|
||||
appver = AppVersion.objects.create(application_id=moz.id)
|
||||
appver = AppVersion.objects.create(application=moz.id)
|
||||
v = Addon.objects.get(id=3615).current_version
|
||||
ApplicationsVersions(application_id=moz.id, version=v,
|
||||
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]
|
||||
|
@ -132,7 +132,7 @@ class TestPreviewForm(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestThemeForm(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/user_2519']
|
||||
fixtures = ['base/user_2519']
|
||||
|
||||
def setUp(self):
|
||||
self.populate()
|
||||
|
@ -142,7 +142,7 @@ class TestThemeForm(amo.tests.TestCase):
|
|||
self.request.amo_user.is_authenticated.return_value = True
|
||||
|
||||
def populate(self):
|
||||
self.cat = Category.objects.create(application_id=amo.FIREFOX.id,
|
||||
self.cat = Category.objects.create(application=amo.FIREFOX.id,
|
||||
type=amo.ADDON_PERSONA, name='xxxx')
|
||||
License.objects.create(id=amo.LICENSE_CC_BY.id)
|
||||
|
||||
|
@ -377,7 +377,7 @@ class TestThemeForm(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestEditThemeForm(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/user_2519']
|
||||
fixtures = ['base/user_2519']
|
||||
|
||||
def setUp(self):
|
||||
self.populate()
|
||||
|
@ -573,7 +573,7 @@ class TestEditThemeForm(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestEditThemeOwnerForm(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users']
|
||||
fixtures = ['base/users']
|
||||
|
||||
def setUp(self):
|
||||
self.instance = Addon.objects.create(
|
||||
|
|
|
@ -175,8 +175,7 @@ class TestActivityLog(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestVersion(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615',
|
||||
'base/thunderbird']
|
||||
fixtures = ['base/users', 'base/addon_3615', 'base/thunderbird']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(pk=3615)
|
||||
|
|
|
@ -32,7 +32,7 @@ from amo.tests import (addon_factory, assert_no_validation_exceptions, formset,
|
|||
initial)
|
||||
from amo.tests.test_helpers import get_image_path
|
||||
from amo.urlresolvers import reverse
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from devhub import tasks
|
||||
from devhub.forms import ContribForm
|
||||
from devhub.models import ActivityLog, BlogPost, SubmitStep
|
||||
|
@ -246,8 +246,7 @@ class TestDashboard(HubTest):
|
|||
|
||||
|
||||
class TestUpdateCompatibility(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_4594_a9',
|
||||
'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_4594_a9', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='del@icio.us', password='password')
|
||||
|
@ -301,11 +300,10 @@ class TestUpdateCompatibility(amo.tests.TestCase):
|
|||
assert doc('.item[data-addonid=3615] .tooltip.compat-error')
|
||||
|
||||
def test_incompat_mobile(self):
|
||||
app = Application.objects.get(id=amo.MOBILE.id)
|
||||
appver = AppVersion.objects.get(version='2.0')
|
||||
appver.update(application=app)
|
||||
appver.update(application=amo.MOBILE.id)
|
||||
av = ApplicationsVersions.objects.all()[0]
|
||||
av.application = app
|
||||
av.application = amo.MOBILE.id
|
||||
av.max = appver
|
||||
av.save()
|
||||
doc = pq(self.client.get(self.url).content)
|
||||
|
@ -313,7 +311,7 @@ class TestUpdateCompatibility(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestDevRequired(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=3615)
|
||||
|
@ -357,7 +355,7 @@ class TestDevRequired(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestVersionStats(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='admin@mozilla.com',
|
||||
|
@ -380,7 +378,7 @@ class TestVersionStats(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestEditPayments(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = self.get_addon()
|
||||
|
@ -588,7 +586,7 @@ class TestEditPayments(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestDisablePayments(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=3615)
|
||||
|
@ -615,7 +613,7 @@ class TestDisablePayments(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestPaymentsProfile(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
raise SkipTest
|
||||
|
@ -806,7 +804,7 @@ class TestHome(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestActivityFeed(amo.tests.TestCase):
|
||||
fixtures = ('base/apps', 'base/users', 'base/addon_3615')
|
||||
fixtures = ('base/users', 'base/addon_3615')
|
||||
|
||||
def setUp(self):
|
||||
super(TestActivityFeed, self).setUp()
|
||||
|
@ -863,7 +861,7 @@ class TestActivityFeed(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestProfileBase(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=3615)
|
||||
|
@ -1664,7 +1662,7 @@ class TestSubmitBump(TestSubmitBase):
|
|||
|
||||
|
||||
class TestSubmitSteps(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='del@icio.us', password='password')
|
||||
|
@ -1750,7 +1748,7 @@ class TestSubmitSteps(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestUpload(BaseUploadTest):
|
||||
fixtures = ['base/apps', 'base/users']
|
||||
fixtures = ['base/users']
|
||||
|
||||
def setUp(self):
|
||||
super(TestUpload, self).setUp()
|
||||
|
@ -1809,7 +1807,7 @@ class TestUpload(BaseUploadTest):
|
|||
|
||||
|
||||
class TestUploadDetail(BaseUploadTest):
|
||||
fixtures = ['base/apps', 'base/appversion', 'base/users']
|
||||
fixtures = ['base/appversion', 'base/users']
|
||||
|
||||
def setUp(self):
|
||||
super(TestUploadDetail, self).setUp()
|
||||
|
@ -1935,7 +1933,7 @@ def assert_json_field(request, field, msg):
|
|||
|
||||
|
||||
class UploadTest(BaseUploadTest, amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
super(UploadTest, self).setUp()
|
||||
|
@ -1947,7 +1945,7 @@ class UploadTest(BaseUploadTest, amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestQueuePosition(UploadTest):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
super(TestQueuePosition, self).setUp()
|
||||
|
@ -1989,7 +1987,7 @@ class TestQueuePosition(UploadTest):
|
|||
|
||||
|
||||
class TestVersionAddFile(UploadTest):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
super(TestVersionAddFile, self).setUp()
|
||||
|
@ -2003,9 +2001,8 @@ class TestVersionAddFile(UploadTest):
|
|||
version_files.save()
|
||||
|
||||
def make_mobile(self):
|
||||
app = Application.objects.get(pk=amo.MOBILE.id)
|
||||
for a in self.version.apps.all():
|
||||
a.application = app
|
||||
a.application = amo.MOBILE.id
|
||||
a.save()
|
||||
|
||||
def post(self, platform=amo.PLATFORM_MAC, source=None):
|
||||
|
@ -2251,7 +2248,7 @@ class TestVersionAddFile(UploadTest):
|
|||
|
||||
|
||||
class TestUploadErrors(UploadTest):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
validator_success = json.dumps({
|
||||
"errors": 0,
|
||||
"success": True,
|
||||
|
@ -2394,7 +2391,7 @@ class TestAddVersion(AddVersionTest):
|
|||
|
||||
|
||||
class TestAddBetaVersion(AddVersionTest):
|
||||
fixtures = ['base/apps', 'base/users', 'base/appversion', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/appversion', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
super(TestAddBetaVersion, self).setUp()
|
||||
|
@ -2512,7 +2509,7 @@ class UploadAddon(object):
|
|||
|
||||
|
||||
class TestCreateAddon(BaseUploadTest, UploadAddon, amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users']
|
||||
fixtures = ['base/users']
|
||||
|
||||
def setUp(self):
|
||||
super(TestCreateAddon, self).setUp()
|
||||
|
@ -2573,7 +2570,7 @@ class TestCreateAddon(BaseUploadTest, UploadAddon, amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestDeleteAddon(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=3615)
|
||||
|
@ -2698,7 +2695,7 @@ class TestRequestReview(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestRedirects(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
self.base = reverse('devhub.index')
|
||||
|
@ -2755,7 +2752,7 @@ class TestDocs(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestRemoveLocale(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=3615)
|
||||
|
|
|
@ -38,7 +38,7 @@ def get_section_url(addon, section, edit=False):
|
|||
|
||||
@override_settings(MEDIA_ROOT=None) # Make it overridable.
|
||||
class TestEdit(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615',
|
||||
fixtures = ['base/users', 'base/addon_3615',
|
||||
'base/addon_5579', 'base/addon_3615_categories']
|
||||
|
||||
def setUp(self):
|
||||
|
@ -303,7 +303,7 @@ class TestEditBasic(TestEdit):
|
|||
c = CollectionAddon.objects.create(addon_id=addon_id,
|
||||
collection=Collection.objects.create())
|
||||
FeaturedCollection.objects.create(collection=c.collection,
|
||||
application_id=amo.FIREFOX.id)
|
||||
application=amo.FIREFOX.id)
|
||||
|
||||
def test_edit_categories_add_creatured(self):
|
||||
raise SkipTest()
|
||||
|
@ -1212,7 +1212,7 @@ class TestEditTechnical(TestEdit):
|
|||
|
||||
|
||||
class TestAdmin(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def login_admin(self):
|
||||
assert self.client.login(username='admin@mozilla.com',
|
||||
|
|
|
@ -13,7 +13,7 @@ from versions.models import License, Version
|
|||
|
||||
|
||||
class TestOwnership(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=3615)
|
||||
|
|
|
@ -19,7 +19,7 @@ from devhub.views import packager_path
|
|||
|
||||
|
||||
class TestPackager(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/appversion',
|
||||
fixtures = ['base/users', 'base/appversion',
|
||||
'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
|
@ -207,7 +207,7 @@ class TestPackager(amo.tests.TestCase):
|
|||
|
||||
@patch.object(amo, 'DEFAULT_MINVER', '3.6')
|
||||
def test_default_firefox_minver(self):
|
||||
eq_(len(AppVersion.objects.filter(application__id=amo.FIREFOX.id,
|
||||
eq_(len(AppVersion.objects.filter(application=amo.FIREFOX.id,
|
||||
version='3.6')), 1)
|
||||
r = self.client.get(self.url)
|
||||
eq_(r.status_code, 200)
|
||||
|
@ -232,8 +232,7 @@ class TestPackager(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestPackagerDownload(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/appversion',
|
||||
'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/appversion', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
self.url = lambda f: reverse('devhub.package_addon_json', args=[f])
|
||||
|
|
|
@ -10,7 +10,7 @@ import amo.tests
|
|||
|
||||
|
||||
class TestPerfViews(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615']
|
||||
fixtures = ['base/users', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
super(TestPerfViews, self).setUp()
|
||||
|
|
|
@ -12,7 +12,7 @@ from amo.urlresolvers import reverse
|
|||
|
||||
|
||||
class TestSubmitPersona(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/user_999']
|
||||
fixtures = ['base/user_999']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='regular@mozilla.com',
|
||||
|
|
|
@ -18,7 +18,7 @@ from addons.models import Addon
|
|||
from amo.tests import assert_no_validation_exceptions
|
||||
from amo.tests.test_helpers import get_image_path
|
||||
from amo.urlresolvers import reverse
|
||||
from applications.models import AppVersion, Application
|
||||
from applications.models import AppVersion
|
||||
from constants.applications import FIREFOX
|
||||
from devhub.tasks import compatibility_check
|
||||
from files.helpers import copyfileobj
|
||||
|
@ -30,8 +30,7 @@ from zadmin.models import ValidationResult
|
|||
|
||||
|
||||
class TestUploadValidation(BaseUploadTest):
|
||||
fixtures = ['base/apps', 'base/users',
|
||||
'devhub/invalid-id-uploaded-xpi.json']
|
||||
fixtures = ['base/users', 'devhub/invalid-id-uploaded-xpi.json']
|
||||
|
||||
def setUp(self):
|
||||
super(TestUploadValidation, self).setUp()
|
||||
|
@ -69,7 +68,7 @@ class TestUploadValidation(BaseUploadTest):
|
|||
|
||||
|
||||
class TestUploadErrors(BaseUploadTest):
|
||||
fixtures = ('base/apps', 'base/addon_3615', 'base/users')
|
||||
fixtures = ('base/addon_3615', 'base/users')
|
||||
|
||||
def setUp(self):
|
||||
super(TestUploadErrors, self).setUp()
|
||||
|
@ -95,7 +94,7 @@ class TestUploadErrors(BaseUploadTest):
|
|||
|
||||
|
||||
class TestFileValidation(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'devhub/addon-validation-1']
|
||||
fixtures = ['base/users', 'devhub/addon-validation-1']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='del@icio.us', password='password')
|
||||
|
@ -198,8 +197,7 @@ class TestValidateAddon(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestValidateFile(BaseUploadTest):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615',
|
||||
'devhub/addon-file-100456']
|
||||
fixtures = ['base/users', 'base/addon_3615', 'devhub/addon-file-100456']
|
||||
|
||||
def setUp(self):
|
||||
super(TestValidateFile, self).setUp()
|
||||
|
@ -426,7 +424,7 @@ class TestValidateFile(BaseUploadTest):
|
|||
})
|
||||
xpi = self.get_upload('extension.xpi')
|
||||
AppVersion.objects.create(
|
||||
application=Application.objects.get(guid=FIREFOX.guid),
|
||||
application=FIREFOX.id,
|
||||
version='10.0.*')
|
||||
|
||||
compatibility_check(xpi, FIREFOX.guid, '10.0.*')
|
||||
|
@ -527,7 +525,7 @@ class TestCompatibilityResults(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestUploadCompatCheck(BaseUploadTest):
|
||||
fixtures = ['base/apps', 'base/appversions', 'base/addon_3615']
|
||||
fixtures = ['base/appversion', 'base/addon_3615']
|
||||
compatibility_result = json.dumps({
|
||||
"errors": 0,
|
||||
"success": True,
|
||||
|
@ -544,8 +542,8 @@ class TestUploadCompatCheck(BaseUploadTest):
|
|||
def setUp(self):
|
||||
super(TestUploadCompatCheck, self).setUp()
|
||||
assert self.client.login(username='del@icio.us', password='password')
|
||||
self.app = Application.objects.get(pk=amo.FIREFOX.id)
|
||||
self.appver = AppVersion.objects.get(application=self.app,
|
||||
self.app = amo.FIREFOX
|
||||
self.appver = AppVersion.objects.get(application=self.app.id,
|
||||
version='3.7a1pre')
|
||||
self.upload_url = reverse('devhub.standalone_upload')
|
||||
|
||||
|
@ -563,7 +561,7 @@ class TestUploadCompatCheck(BaseUploadTest):
|
|||
# Simulate how JS posts data w/ app/version from the form.
|
||||
res = self.client.post(self.upload_url,
|
||||
{'upload': f,
|
||||
'app_id': self.app.pk,
|
||||
'app_id': self.app.id,
|
||||
'version_id': self.appver.pk},
|
||||
follow=True)
|
||||
return json.loads(res.content)
|
||||
|
@ -625,7 +623,7 @@ class TestUploadCompatCheck(BaseUploadTest):
|
|||
res = self.client.get(reverse('devhub.check_addon_compatibility'))
|
||||
eq_(res.status_code, 200)
|
||||
doc = pq(res.content)
|
||||
data = {'application_id': amo.FIREFOX.id,
|
||||
data = {'application': amo.FIREFOX.id,
|
||||
'csrfmiddlewaretoken':
|
||||
doc('input[name=csrfmiddlewaretoken]').val()}
|
||||
r = self.client.post(doc('#id_application').attr('data-url'),
|
||||
|
|
|
@ -12,7 +12,7 @@ import amo.tests
|
|||
from amo.urlresolvers import reverse
|
||||
from amo.tests import formset, initial
|
||||
from addons.models import Addon
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from devhub.models import ActivityLog
|
||||
from files.models import File
|
||||
from users.models import UserProfile
|
||||
|
@ -337,8 +337,7 @@ class TestVersion(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestVersionEdit(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615',
|
||||
'base/thunderbird']
|
||||
fixtures = ['base/users', 'base/addon_3615', 'base/thunderbird']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='del@icio.us', password='password')
|
||||
|
@ -347,9 +346,9 @@ class TestVersionEdit(amo.tests.TestCase):
|
|||
self.url = reverse('devhub.versions.edit',
|
||||
args=['a3615', self.version.id])
|
||||
self.v1, _created = AppVersion.objects.get_or_create(
|
||||
application_id=amo.FIREFOX.id, version='1.0')
|
||||
application=amo.FIREFOX.id, version='1.0')
|
||||
self.v5, _created = AppVersion.objects.get_or_create(
|
||||
application_id=amo.FIREFOX.id, version='5.0')
|
||||
application=amo.FIREFOX.id, version='5.0')
|
||||
|
||||
def get_addon(self):
|
||||
return Addon.objects.no_cache().get(id=3615)
|
||||
|
@ -368,10 +367,10 @@ class TestVersionEditMobile(TestVersionEdit):
|
|||
def setUp(self):
|
||||
super(TestVersionEditMobile, self).setUp()
|
||||
self.version.apps.all().delete()
|
||||
mobile = Application.objects.get(id=amo.MOBILE.id)
|
||||
app_vr = AppVersion.objects.create(application=mobile, version='1.0')
|
||||
app_vr = AppVersion.objects.create(application=amo.MOBILE.id,
|
||||
version='1.0')
|
||||
ApplicationsVersions.objects.create(version=self.version,
|
||||
application=mobile,
|
||||
application=amo.MOBILE.id,
|
||||
min=app_vr, max=app_vr)
|
||||
self.version.files.update(platform=amo.PLATFORM_ANDROID.id)
|
||||
|
||||
|
@ -436,11 +435,10 @@ class TestVersionEditDetails(TestVersionEdit):
|
|||
assert doc('p.add-app')[0].attrib['class'] == 'add-app'
|
||||
|
||||
def test_add_not(self):
|
||||
Application(id=52).save()
|
||||
for id in [18, 52, 59, 60, 61]:
|
||||
av = AppVersion(application_id=id, version='1')
|
||||
av = AppVersion(application=id, version='1')
|
||||
av.save()
|
||||
ApplicationsVersions(application_id=id, min=av, max=av,
|
||||
ApplicationsVersions(application=id, min=av, max=av,
|
||||
version=self.version).save()
|
||||
|
||||
res = self.client.get(self.url)
|
||||
|
@ -473,8 +471,7 @@ class TestVersionEditDetails(TestVersionEdit):
|
|||
|
||||
class TestVersionEditSearchEngine(TestVersionEdit):
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=605941
|
||||
fixtures = ['base/apps', 'base/users',
|
||||
'base/thunderbird', 'base/addon_4594_a9.json']
|
||||
fixtures = ['base/users', 'base/thunderbird', 'base/addon_4594_a9.json']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='admin@mozilla.com',
|
||||
|
@ -644,9 +641,8 @@ class TestVersionEditFiles(TestVersionEdit):
|
|||
set(['radio']))
|
||||
|
||||
def test_mobile_addon_supports_only_mobile_platforms(self):
|
||||
app = Application.objects.get(pk=amo.MOBILE.id)
|
||||
for a in self.version.apps.all():
|
||||
a.application = app
|
||||
a.application = amo.MOBILE.id
|
||||
a.save()
|
||||
self.version.files.all().update(platform=amo.PLATFORM_ALL_MOBILE.id)
|
||||
forms = self.client.get(self.url).context['file_form'].forms
|
||||
|
@ -656,8 +652,7 @@ class TestVersionEditFiles(TestVersionEdit):
|
|||
|
||||
|
||||
class TestPlatformSearch(TestVersionEdit):
|
||||
fixtures = ['base/apps', 'base/users',
|
||||
'base/thunderbird', 'base/addon_4594_a9.json']
|
||||
fixtures = ['base/users', 'base/thunderbird', 'base/addon_4594_a9.json']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='admin@mozilla.com',
|
||||
|
|
|
@ -39,7 +39,7 @@ from amo.decorators import json_view, login_required, post_required, write
|
|||
from amo.helpers import absolutify, urlparams
|
||||
from amo.urlresolvers import reverse
|
||||
from amo.utils import escape_all, HttpResponseSendFile, MenuItem
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from devhub import perf
|
||||
from devhub.decorators import dev_required
|
||||
from devhub.forms import CheckCompatibilityForm
|
||||
|
@ -514,7 +514,7 @@ def profile(request, addon_id, addon):
|
|||
@post_required
|
||||
@json_view
|
||||
def compat_application_versions(request):
|
||||
app_id = request.POST['application_id']
|
||||
app_id = request.POST['application']
|
||||
f = CheckCompatibilityForm()
|
||||
return {'choices': f.version_choices_for_app_id(app_id)}
|
||||
|
||||
|
@ -626,8 +626,11 @@ def upload(request, addon_slug=None, is_standalone=False):
|
|||
if request.user.is_authenticated():
|
||||
fu.user = request.amo_user
|
||||
fu.save()
|
||||
if request.POST.get('app_id') and request.POST.get('version_id'):
|
||||
app = get_object_or_404(Application, pk=request.POST['app_id'])
|
||||
app_id = request.POST.get('app_id')
|
||||
if app_id and request.POST.get('version_id'):
|
||||
app = amo.APPS_ALL.get(int(app_id))
|
||||
if not app:
|
||||
raise http.Http404()
|
||||
ver = get_object_or_404(AppVersion, pk=request.POST['version_id'])
|
||||
tasks.compatibility_check.delay(fu.pk, app.guid, ver.version)
|
||||
else:
|
||||
|
@ -1112,7 +1115,7 @@ def version_edit(request, addon_id, addon, version_id):
|
|||
def _log_max_version_change(addon, version, appversion):
|
||||
details = {'version': version.version,
|
||||
'target': appversion.version.version,
|
||||
'application': appversion.application.pk}
|
||||
'application': appversion.application}
|
||||
amo.log(amo.LOG.MAX_APPVERSION_UPDATED,
|
||||
addon, version, details=details)
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ class DiscoveryModule(amo.models.ModelBase):
|
|||
The modules are defined statically in modules.py and linked to a database
|
||||
row through the module's name.
|
||||
"""
|
||||
app = models.ForeignKey('applications.Application')
|
||||
app = models.PositiveIntegerField(db_column='app_id')
|
||||
module = models.CharField(max_length=255)
|
||||
ordering = models.IntegerField(null=True, blank=True)
|
||||
locales = models.CharField(max_length=255, blank=True, default='')
|
||||
|
|
|
@ -15,7 +15,7 @@ import addons.signals
|
|||
from amo.urlresolvers import reverse
|
||||
from addons.models import (Addon, AddonDependency, CompatOverride,
|
||||
CompatOverrideRange, Preview)
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from bandwagon.models import MonthlyPick, SyncedCollection
|
||||
from bandwagon.tests.test_models import TestRecommendations as Recs
|
||||
from discovery import views
|
||||
|
@ -27,7 +27,7 @@ from versions.models import Version, ApplicationsVersions
|
|||
|
||||
|
||||
class TestRecs(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/appversion', 'base/addon_3615',
|
||||
fixtures = ['base/appversion', 'base/addon_3615',
|
||||
'base/addon-recs', 'base/addon_5299_gcal', 'base/category',
|
||||
'base/featured', 'addons/featured']
|
||||
|
||||
|
@ -54,7 +54,7 @@ class TestRecs(amo.tests.TestCase):
|
|||
v = Version.objects.create(addon=addon)
|
||||
File.objects.create(version=v, status=amo.STATUS_PUBLIC)
|
||||
ApplicationsVersions.objects.create(
|
||||
version=v, application_id=amo.FIREFOX.id,
|
||||
version=v, application=amo.FIREFOX.id,
|
||||
min_id=self.min_id, max_id=self.max_id)
|
||||
addon.update(_current_version=v)
|
||||
addons.signals.version_changed.send(sender=addon)
|
||||
|
@ -188,17 +188,15 @@ class TestRecs(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestModuleAdmin(amo.tests.TestCase):
|
||||
fixtures = ['base/apps']
|
||||
|
||||
def test_sync_db_and_registry(self):
|
||||
def check():
|
||||
views._sync_db_and_registry(qs, app)
|
||||
views._sync_db_and_registry(qs, 1)
|
||||
eq_(qs.count(), len(registry))
|
||||
modules = qs.values_list('module', flat=True)
|
||||
eq_(set(modules), set(registry.keys()))
|
||||
|
||||
app = Application.objects.create()
|
||||
qs = DiscoveryModule.objects.no_cache().filter(app=app)
|
||||
qs = DiscoveryModule.objects.no_cache().filter(app=1)
|
||||
eq_(qs.count(), 0)
|
||||
|
||||
# All our modules get added.
|
||||
|
@ -221,7 +219,7 @@ class TestModuleAdmin(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestUrls(amo.tests.TestCase):
|
||||
fixtures = ['base/users', 'base/apps', 'base/featured', 'addons/featured',
|
||||
fixtures = ['base/users', 'base/featured', 'addons/featured',
|
||||
'base/addon_3615']
|
||||
|
||||
def test_reverse(self):
|
||||
|
@ -264,7 +262,7 @@ class TestUrls(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestPromos(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'discovery/discoverymodules']
|
||||
fixtures = ['base/users', 'discovery/discoverymodules']
|
||||
|
||||
def get_disco_url(self, platform, version):
|
||||
return reverse('discovery.pane.promos', args=[platform, version])
|
||||
|
@ -301,9 +299,8 @@ class TestPromos(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestPane(amo.tests.TestCase):
|
||||
fixtures = ['addons/featured', 'base/addon_3615', 'base/apps',
|
||||
'base/collections', 'base/featured', 'base/users',
|
||||
'bandwagon/featured_collections']
|
||||
fixtures = ['addons/featured', 'base/addon_3615', 'base/collections',
|
||||
'base/featured', 'base/users', 'bandwagon/featured_collections']
|
||||
|
||||
def setUp(self):
|
||||
self.url = reverse('discovery.pane', args=['3.7a1pre', 'Darwin'])
|
||||
|
@ -393,7 +390,7 @@ class TestPane(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestDetails(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_3615', 'base/addon_592']
|
||||
fixtures = ['base/addon_3615', 'base/addon_592']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = self.get_addon()
|
||||
|
@ -471,7 +468,7 @@ class TestPersonaDetails(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestDownloadSources(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_3615', 'base/users',
|
||||
fixtures = ['base/addon_3615', 'base/users',
|
||||
'base/collections', 'base/featured', 'addons/featured',
|
||||
'discovery/discoverymodules']
|
||||
|
||||
|
@ -518,14 +515,14 @@ class TestDownloadSources(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestMonthlyPick(amo.tests.TestCase):
|
||||
fixtures = ['base/users', 'base/apps', 'base/addon_3615',
|
||||
fixtures = ['base/users', 'base/addon_3615',
|
||||
'discovery/discoverymodules']
|
||||
|
||||
def setUp(self):
|
||||
self.url = reverse('discovery.pane.promos', args=['Darwin', '10.0'])
|
||||
self.addon = Addon.objects.get(id=3615)
|
||||
DiscoveryModule.objects.create(
|
||||
app=Application.objects.get(id=amo.FIREFOX.id), ordering=4,
|
||||
app=amo.FIREFOX.id, ordering=4,
|
||||
module='Monthly Pick')
|
||||
|
||||
def test_monthlypick(self):
|
||||
|
@ -573,7 +570,7 @@ class TestMonthlyPick(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestPaneMoreAddons(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/appversion']
|
||||
fixtures = ['base/appversion']
|
||||
|
||||
def setUp(self):
|
||||
self.addon1 = addon_factory(hotness=99,
|
||||
|
@ -634,7 +631,7 @@ class TestPaneMoreAddons(amo.tests.TestCase):
|
|||
# Add override for this add-on.
|
||||
compat = CompatOverride.objects.create(guid='three', addon=addon3)
|
||||
CompatOverrideRange.objects.create(
|
||||
compat=compat, app=Application.objects.get(pk=1),
|
||||
compat=compat, app=1,
|
||||
min_version=addon3.current_version.version, max_version='*')
|
||||
|
||||
res = self.client.get(self._url(version='12.0', compat_mode='normal'))
|
||||
|
|
|
@ -150,7 +150,7 @@ def module_admin(request):
|
|||
SELECT * from discovery_modules WHERE app_id = %s
|
||||
ORDER BY ordering IS NULL, ordering""", [APP.id])
|
||||
qs.ordered = True # The formset looks for this.
|
||||
_sync_db_and_registry(qs, APP)
|
||||
_sync_db_and_registry(qs, APP.id)
|
||||
|
||||
Form = modelformset_factory(DiscoveryModule, form=DiscoveryModuleForm,
|
||||
can_delete=True, extra=0)
|
||||
|
@ -163,14 +163,14 @@ def module_admin(request):
|
|||
return render(request, 'discovery/module_admin.html', {'formset': formset})
|
||||
|
||||
|
||||
def _sync_db_and_registry(qs, app):
|
||||
def _sync_db_and_registry(qs, app_id):
|
||||
"""Match up the module registry and DiscoveryModule rows in the db."""
|
||||
existing = dict((m.module, m) for m in qs)
|
||||
to_add = [m for m in module_registry if m not in existing]
|
||||
to_delete = [m for m in existing if m not in module_registry]
|
||||
for m in to_add:
|
||||
DiscoveryModule.objects.get_or_create(module=m, app_id=app.id)
|
||||
DiscoveryModule.objects.filter(module__in=to_delete, app=app.id).delete()
|
||||
DiscoveryModule.objects.get_or_create(module=m, app=app_id)
|
||||
DiscoveryModule.objects.filter(module__in=to_delete, app=app_id).delete()
|
||||
if to_add or to_delete:
|
||||
qs._result_cache = None
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ class QueueSearchForm(happyforms.Form):
|
|||
w.attrs['data-url'] = reverse('editors.application_versions_json')
|
||||
|
||||
def version_choices_for_app_id(self, app_id):
|
||||
versions = AppVersion.objects.filter(application__id=app_id)
|
||||
versions = AppVersion.objects.filter(application=app_id)
|
||||
return [('', '')] + [(v.version, v.version) for v in versions]
|
||||
|
||||
def clean_addon_type_ids(self):
|
||||
|
|
|
@ -12,7 +12,7 @@ from amo.tests import addon_factory
|
|||
from addons.models import Addon
|
||||
from versions.models import Version, version_uploaded, ApplicationsVersions
|
||||
from files.models import File
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from editors.models import (EditorSubscription, RereviewQueueTheme,
|
||||
ReviewerScore, send_notifications,
|
||||
ViewFastTrackQueue, ViewFullReviewQueue,
|
||||
|
@ -28,10 +28,8 @@ def create_addon_file(name, version_str, addon_status, file_status,
|
|||
file_kw = {}
|
||||
if version_kw is None:
|
||||
version_kw = {}
|
||||
app, created_ = Application.objects.get_or_create(id=application.id,
|
||||
guid=application.guid)
|
||||
app_vr, created_ = AppVersion.objects.get_or_create(application=app,
|
||||
version='1.0')
|
||||
app_vr, created_ = AppVersion.objects.get_or_create(
|
||||
application=application.id, version='1.0')
|
||||
try:
|
||||
ad = Addon.objects.get(name__localized_string=name)
|
||||
except Addon.DoesNotExist:
|
||||
|
@ -43,7 +41,7 @@ def create_addon_file(name, version_str, addon_status, file_status,
|
|||
if not created_:
|
||||
vr.update(**version_kw)
|
||||
va, created_ = ApplicationsVersions.objects.get_or_create(
|
||||
version=vr, application=app, min=app_vr, max=app_vr)
|
||||
version=vr, application=application.id, min=app_vr, max=app_vr)
|
||||
file_ = File.objects.create(version=vr, filename=u"%s.xpi" % name,
|
||||
platform=platform.id, status=file_status,
|
||||
**file_kw)
|
||||
|
|
|
@ -22,7 +22,6 @@ from addons.models import Addon, AddonDependency, AddonUser
|
|||
from amo.tests import check_links, formset, initial
|
||||
from amo.urlresolvers import reverse
|
||||
from amo.utils import urlparams
|
||||
from applications.models import Application
|
||||
from devhub.models import ActivityLog
|
||||
from editors.models import EditorSubscription, ReviewerScore
|
||||
from files.models import File
|
||||
|
@ -1105,7 +1104,7 @@ class SearchTest(EditorTest):
|
|||
|
||||
|
||||
class TestQueueSearch(SearchTest):
|
||||
fixtures = ['base/users', 'base/apps', 'base/appversion']
|
||||
fixtures = ['base/users', 'base/appversion']
|
||||
|
||||
def setUp(self):
|
||||
super(TestQueueSearch, self).setUp()
|
||||
|
@ -1318,10 +1317,10 @@ class TestQueueSearch(SearchTest):
|
|||
d = create_addon_file('Bieber For Mobile 4.0b2pre', '0.1',
|
||||
amo.STATUS_NOMINATED, amo.STATUS_UNREVIEWED,
|
||||
application=amo.MOBILE)
|
||||
app = Application.objects.get(pk=amo.MOBILE.id)
|
||||
max = AppVersion.objects.get(application=app, version='4.0b2pre')
|
||||
(ApplicationsVersions.objects
|
||||
.filter(application=app, version=d['version']).update(max=max))
|
||||
max = AppVersion.objects.get(application=amo.MOBILE.id,
|
||||
version='4.0b2pre')
|
||||
(ApplicationsVersions.objects.filter(
|
||||
application=amo.MOBILE.id, version=d['version']).update(max=max))
|
||||
r = self.search(application_id=amo.MOBILE.id, max_version='4.0b2pre')
|
||||
eq_(self.named_addons(r), [u'Bieber For Mobile 4.0b2pre'])
|
||||
|
||||
|
@ -1679,16 +1678,14 @@ class TestReview(ReviewBase):
|
|||
self.addon_file(u'something', u'0.2', amo.STATUS_PUBLIC,
|
||||
amo.STATUS_UNREVIEWED)
|
||||
|
||||
a1, c = Application.objects.get_or_create(id=amo.THUNDERBIRD.id)
|
||||
a2, c = Application.objects.get_or_create(id=amo.SEAMONKEY.id)
|
||||
av = AppVersion.objects.all()[0]
|
||||
v = self.addon.versions.all()[0]
|
||||
|
||||
ApplicationsVersions.objects.create(version=v,
|
||||
application=a1, min=av, max=av)
|
||||
application=amo.THUNDERBIRD.id, min=av, max=av)
|
||||
|
||||
ApplicationsVersions.objects.create(version=v,
|
||||
application=a2, min=av, max=av)
|
||||
application=amo.SEAMONKEY.id, min=av, max=av)
|
||||
|
||||
eq_(self.addon.versions.count(), 1)
|
||||
url = reverse('editors.review', args=[self.addon.slug])
|
||||
|
|
|
@ -30,7 +30,7 @@ from amo.decorators import use_master
|
|||
from amo.storage_utils import copy_stored_file, move_stored_file
|
||||
from amo.urlresolvers import reverse
|
||||
from amo.helpers import user_media_path, user_media_url
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
import devhub.signals
|
||||
from devhub.utils import limit_validation_results, escape_validation
|
||||
from files.utils import SafeUnzip
|
||||
|
@ -513,8 +513,8 @@ class FileUpload(amo.models.ModelBase):
|
|||
validation = models.TextField(null=True)
|
||||
_escaped_validation = models.TextField(
|
||||
null=True, db_column='escaped_validation')
|
||||
compat_with_app = models.ForeignKey(
|
||||
Application, null=True, related_name='uploads_compat_for_app')
|
||||
compat_with_app = models.PositiveIntegerField(
|
||||
db_column="compat_with_app_id", null=True)
|
||||
compat_with_appver = models.ForeignKey(
|
||||
AppVersion, null=True, related_name='uploads_compat_for_appver')
|
||||
task_error = models.TextField(null=True)
|
||||
|
|
|
@ -161,7 +161,7 @@ def repackage_jetpack(builder_data, **kw):
|
|||
# Sync the compatible apps of the new version with data from the old
|
||||
# version if the repack didn't specify compat info.
|
||||
for app in old_version.apps.values():
|
||||
sync_app = amo.APP_IDS[app['application_id']]
|
||||
sync_app = amo.APP_IDS[app['application']]
|
||||
new_compat = new_version.compatible_apps
|
||||
if sync_app not in new_compat:
|
||||
app.update(version_id=new_version.id, id=None)
|
||||
|
|
|
@ -201,7 +201,7 @@ class TestFileHelper(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestSearchEngineHelper(amo.tests.TestCase):
|
||||
fixtures = ['base/addon_4594_a9', 'base/apps']
|
||||
fixtures = ['base/addon_4594_a9']
|
||||
|
||||
def setUp(self):
|
||||
self.left = File.objects.get(pk=25753)
|
||||
|
|
|
@ -22,7 +22,7 @@ import devhub.signals
|
|||
|
||||
from amo.utils import rm_local_tmp_dir
|
||||
from addons.models import Addon
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from files.models import File, FileUpload, FileValidation, nfd_str
|
||||
from files.helpers import copyfileobj
|
||||
from files.utils import check_xpi_info, JetpackUpgrader, parse_addon, parse_xpi
|
||||
|
@ -33,7 +33,6 @@ class UploadTest(amo.tests.TestCase, amo.tests.AMOPaths):
|
|||
"""
|
||||
Base for tests that mess with file uploads, safely using temp directories.
|
||||
"""
|
||||
fixtures = ['applications/all_apps.json', 'base/appversion']
|
||||
|
||||
def setUp(self):
|
||||
# The validator task (post Addon upload) loads apps.json
|
||||
|
@ -295,11 +294,10 @@ class TestFile(amo.tests.TestCase, amo.tests.AMOPaths):
|
|||
|
||||
|
||||
class TestParseXpi(amo.tests.TestCase):
|
||||
fixtures = ['base/apps']
|
||||
|
||||
def setUp(self):
|
||||
for version in ('3.0', '3.6.*'):
|
||||
AppVersion.objects.create(application_id=amo.FIREFOX.id,
|
||||
AppVersion.objects.create(application=amo.FIREFOX.id,
|
||||
version=version)
|
||||
|
||||
def parse(self, addon=None, filename='extension.xpi'):
|
||||
|
@ -330,8 +328,8 @@ class TestParseXpi(amo.tests.TestCase):
|
|||
AppVersion.objects.all().delete()
|
||||
eq_(self.parse()['apps'], [])
|
||||
|
||||
@mock.patch.object(amo.FIREFOX, 'guid', 'iamabadguid')
|
||||
def test_parse_apps_bad_guid(self):
|
||||
Application.objects.all().delete()
|
||||
eq_(self.parse()['apps'], [])
|
||||
|
||||
def test_guid_match(self):
|
||||
|
@ -432,27 +430,13 @@ class TestParseXpi(amo.tests.TestCase):
|
|||
result = self.parse(filename='strict-compat.xpi')
|
||||
eq_(result['strict_compatibility'], True)
|
||||
|
||||
def test_unsupported_version_only(self):
|
||||
guid = '{aa3c5121-dab2-40e2-81ca-7ea25febc110}'
|
||||
android = Application.objects.get(guid=guid)
|
||||
# Make sure supported application and version exist.
|
||||
AppVersion.objects.create(application=android, version="30.0")
|
||||
AppVersion.objects.create(application=android, version="32.0")
|
||||
android.update(supported=True)
|
||||
result = self.parse(filename='unsupported_version_only.xpi')
|
||||
eq_(result['apps'][0].appdata.guid, guid)
|
||||
android.update(supported=False)
|
||||
result = self.parse(filename='unsupported_version_only.xpi')
|
||||
eq_(result['apps'], [])
|
||||
|
||||
|
||||
class TestParseAlternateXpi(amo.tests.TestCase, amo.tests.AMOPaths):
|
||||
# This install.rdf is completely different from our other xpis.
|
||||
fixtures = ['base/apps']
|
||||
|
||||
def setUp(self):
|
||||
for version in ('3.0', '4.0b3pre'):
|
||||
AppVersion.objects.create(application_id=amo.FIREFOX.id,
|
||||
AppVersion.objects.create(application=amo.FIREFOX.id,
|
||||
version=version)
|
||||
|
||||
def parse(self, filename='alt-rdf.xpi'):
|
||||
|
@ -490,8 +474,7 @@ class TestParseAlternateXpi(amo.tests.TestCase, amo.tests.AMOPaths):
|
|||
|
||||
|
||||
class TestFileUpload(UploadTest):
|
||||
fixtures = ['applications/all_apps.json', 'base/appversion',
|
||||
'base/addon_3615']
|
||||
fixtures = ['base/appversion', 'base/addon_3615']
|
||||
|
||||
def setUp(self):
|
||||
super(TestFileUpload, self).setUp()
|
||||
|
@ -775,7 +758,6 @@ class TestFileUpload(UploadTest):
|
|||
|
||||
|
||||
class TestFileFromUpload(UploadTest):
|
||||
fixtures = ['base/apps']
|
||||
|
||||
def setUp(self):
|
||||
super(TestFileFromUpload, self).setUp()
|
||||
|
@ -783,7 +765,7 @@ class TestFileFromUpload(UploadTest):
|
|||
amo.MOBILE: ['0.1', '2.0a1pre']}
|
||||
for app, versions in appver.items():
|
||||
for version in versions:
|
||||
AppVersion(application_id=app.id, version=version).save()
|
||||
AppVersion(application=app.id, version=version).save()
|
||||
self.platform = amo.PLATFORM_MAC.id
|
||||
self.addon = Addon.objects.create(guid='guid@jetpack',
|
||||
type=amo.ADDON_EXTENSION,
|
||||
|
@ -1094,6 +1076,7 @@ class TestCheckJetpackVersion(amo.tests.TestCase):
|
|||
|
||||
|
||||
class LanguagePackBase(UploadTest):
|
||||
fixtures = ['base/appversion']
|
||||
|
||||
def setUp(self):
|
||||
super(LanguagePackBase, self).setUp()
|
||||
|
|
|
@ -207,9 +207,8 @@ class TestRepackageJetpack(amo.tests.TestCase):
|
|||
|
||||
def test_supported_apps(self):
|
||||
# Create AppVersions to match what's in the xpi.
|
||||
AppVersion.objects.create(application_id=amo.FIREFOX.id, version='3.6')
|
||||
AppVersion.objects.create(
|
||||
application_id=amo.FIREFOX.id, version='4.0b6')
|
||||
AppVersion.objects.create(application=amo.FIREFOX.id, version='3.6')
|
||||
AppVersion.objects.create(application=amo.FIREFOX.id, version='4.0b6')
|
||||
|
||||
# Make sure the new appver matches the old appver.
|
||||
new = tasks.repackage_jetpack(self.builder_data()).version
|
||||
|
|
|
@ -7,7 +7,7 @@ from nose.tools import eq_
|
|||
import amo
|
||||
import amo.tests
|
||||
from addons.models import Addon
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from files.models import File
|
||||
from files.utils import find_jetpacks, PackageJSONExtractor
|
||||
from versions.models import Version
|
||||
|
@ -80,9 +80,8 @@ class TestPackageJSONExtractor(amo.tests.TestCase):
|
|||
yield PackageJSONExtractor(f.name)
|
||||
|
||||
def create_appversion(self, name, version):
|
||||
app_guid = amo.APPS[name].guid
|
||||
app = Application.objects.supported().get(guid=app_guid)
|
||||
return AppVersion.objects.create(application=app, version=version)
|
||||
return AppVersion.objects.create(application=amo.APPS[name].id,
|
||||
version=version)
|
||||
|
||||
def test_guid(self):
|
||||
"""Use id for the guid."""
|
||||
|
|
|
@ -27,7 +27,7 @@ from tower import ugettext as _
|
|||
|
||||
import amo
|
||||
from amo.utils import rm_local_tmp_dir
|
||||
from applications.models import AppVersion, Application
|
||||
from applications.models import AppVersion
|
||||
from versions.compare import version_int as vint
|
||||
|
||||
|
||||
|
@ -102,10 +102,6 @@ class PackageJSONExtractor(object):
|
|||
return self.data.get(key, default)
|
||||
|
||||
def apps(self):
|
||||
def supported_app(app):
|
||||
return (Application.objects.supported()
|
||||
.filter(guid=app.guid)
|
||||
.exists())
|
||||
|
||||
def find_appversion(app, version_req):
|
||||
"""
|
||||
|
@ -124,7 +120,7 @@ class PackageJSONExtractor(object):
|
|||
for engine, version in self.get('engines', {}).items():
|
||||
name = 'android' if engine == 'fennec' else engine
|
||||
app = amo.APPS.get(name)
|
||||
if app and supported_app(app):
|
||||
if app and app.guid in amo.APP_GUIDS:
|
||||
appversion = find_appversion(app, version)
|
||||
yield Extractor.App(
|
||||
appdata=app, id=app.id, min=appversion, max=appversion)
|
||||
|
@ -217,8 +213,7 @@ class RDFExtractor(object):
|
|||
app = amo.APP_GUIDS.get(self.find('id', ctx))
|
||||
if not app:
|
||||
continue
|
||||
if (not Application.objects.supported()
|
||||
.filter(guid=app.guid).exists()):
|
||||
if not app.guid in amo.APP_GUIDS:
|
||||
continue
|
||||
try:
|
||||
qs = AppVersion.objects.filter(application=app.id)
|
||||
|
|
|
@ -119,11 +119,11 @@ def categories(request, locale_code):
|
|||
category_objects = dict([(c.id, c) for c in cats])
|
||||
# Initial data to pre-populate forms.
|
||||
initial = [dict(id=c.id, name=strings.get(c.name_id),
|
||||
application=c.application_id) for c in cats]
|
||||
application=c.application) for c in cats]
|
||||
# Group categories by application, and sort by name within app groups.
|
||||
categories = []
|
||||
category_no_app = None
|
||||
for key, group in groupby(cats, lambda c: c.application_id):
|
||||
for key, group in groupby(cats, lambda c: c.application):
|
||||
sorted_cats = sorted(group, key=lambda c: c.name)
|
||||
if key:
|
||||
categories.append((key, sorted_cats))
|
||||
|
|
|
@ -2,17 +2,14 @@ from django.conf import settings
|
|||
|
||||
from mock import patch
|
||||
from nose.tools import eq_
|
||||
from pyquery import PyQuery as pq
|
||||
|
||||
import amo.tests
|
||||
from amo.urlresolvers import reverse
|
||||
from perf.models import Performance
|
||||
from addons.models import Addon
|
||||
|
||||
|
||||
class TestModels(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_3615', 'base/addon_5299_gcal',
|
||||
'perf/index']
|
||||
fixtures = ['base/addon_3615', 'base/addon_5299_gcal', 'perf/index']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(pk=3615)
|
||||
|
|
|
@ -11,7 +11,7 @@ from users.models import UserProfile
|
|||
|
||||
|
||||
class TestReviewModel(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'reviews/test_models']
|
||||
fixtures = ['reviews/test_models']
|
||||
|
||||
def test_translations(self):
|
||||
translation.activate('en-US')
|
||||
|
@ -36,7 +36,7 @@ class TestReviewModel(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestGroupedRating(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'reviews/dev-reply']
|
||||
fixtures = ['reviews/dev-reply']
|
||||
grouped_ratings = [(1, 0), (2, 0), (3, 0), (4, 1), (5, 0)]
|
||||
|
||||
def test_get_none(self):
|
||||
|
@ -58,7 +58,7 @@ class TestGroupedRating(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestSpamTest(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'reviews/test_models']
|
||||
fixtures = ['reviews/test_models']
|
||||
|
||||
def test_create_not_there(self):
|
||||
Review.objects.all().delete()
|
||||
|
|
|
@ -14,7 +14,7 @@ from users.models import UserProfile
|
|||
|
||||
|
||||
class ReviewTest(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'reviews/dev-reply.json', 'base/admin']
|
||||
fixtures = ['reviews/dev-reply.json', 'base/admin']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=1865)
|
||||
|
@ -452,8 +452,7 @@ class TestTranslate(ReviewTest):
|
|||
|
||||
|
||||
class TestMobileReviews(amo.tests.MobileTest, amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'reviews/dev-reply.json', 'base/admin',
|
||||
'base/users']
|
||||
fixtures = ['reviews/dev-reply.json', 'base/admin', 'base/users']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=1865)
|
||||
|
|
|
@ -127,7 +127,7 @@ class SearchBase(amo.tests.ESTestCase):
|
|||
|
||||
|
||||
class TestESSearch(SearchBase):
|
||||
fixtures = ['base/apps', 'base/category']
|
||||
fixtures = ['base/category']
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
@ -462,7 +462,7 @@ class TestESSearch(SearchBase):
|
|||
self.check_cat_filters(dict(cat=999))
|
||||
|
||||
def test_defaults_atype_foreign_cat(self):
|
||||
cat = Category.objects.create(application_id=amo.THUNDERBIRD.id,
|
||||
cat = Category.objects.create(application=amo.THUNDERBIRD.id,
|
||||
type=amo.ADDON_EXTENSION)
|
||||
self.check_cat_filters(dict(atype=amo.ADDON_EXTENSION, cat=cat.id))
|
||||
|
||||
|
@ -616,7 +616,6 @@ class TestESSearch(SearchBase):
|
|||
|
||||
|
||||
class TestPersonaSearch(SearchBase):
|
||||
fixtures = ['base/apps']
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
@ -778,7 +777,6 @@ class TestPersonaSearch(SearchBase):
|
|||
|
||||
|
||||
class TestCollectionSearch(SearchBase):
|
||||
fixtures = ['base/apps']
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
@ -977,9 +975,9 @@ class TestCollectionSearch(SearchBase):
|
|||
|
||||
def test_results_other_applications(self):
|
||||
tb_collection = amo.tests.collection_factory(
|
||||
application_id=amo.THUNDERBIRD.id)
|
||||
application=amo.THUNDERBIRD.id)
|
||||
sm_collection = amo.tests.collection_factory(
|
||||
application_id=amo.SEAMONKEY.id)
|
||||
application=amo.SEAMONKEY.id)
|
||||
self.refresh()
|
||||
|
||||
r = self.client.get(self.url)
|
||||
|
|
|
@ -1,13 +1,4 @@
|
|||
[
|
||||
{
|
||||
"pk": 1,
|
||||
"model": "applications.application",
|
||||
"fields": {
|
||||
"guid": "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
|
||||
"modified": "2008-11-03 15:34:59",
|
||||
"created": "2007-03-05 13:09:26"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk": 282,
|
||||
"model": "applications.appversion",
|
||||
|
|
|
@ -58,8 +58,7 @@ class TestGoogleAnalytics(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestTotalContributions(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/appversion', 'base/users',
|
||||
'base/addon_3615']
|
||||
fixtures = ['base/appversion', 'base/users', 'base/addon_3615']
|
||||
|
||||
def test_total_contributions(self):
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ from users.utils import find_users
|
|||
|
||||
class TestUserProfile(amo.tests.TestCase):
|
||||
fixtures = ('base/addon_3615', 'base/user_2519', 'base/user_4043307',
|
||||
'users/test_backends', 'base/apps',)
|
||||
'users/test_backends')
|
||||
|
||||
def test_anonymize(self):
|
||||
u = UserProfile.objects.get(id='4043307')
|
||||
|
|
|
@ -1133,10 +1133,7 @@ class TestProfileView(UserViewBase):
|
|||
|
||||
|
||||
class TestProfileLinks(UserViewBase):
|
||||
fixtures = ['base/apps',
|
||||
'base/appversion',
|
||||
'base/featured',
|
||||
'users/test_backends']
|
||||
fixtures = ['base/appversion', 'base/featured', 'users/test_backends']
|
||||
|
||||
def test_edit_buttons(self):
|
||||
"""Ensure admin/user edit buttons are shown."""
|
||||
|
@ -1190,7 +1187,7 @@ class TestProfileLinks(UserViewBase):
|
|||
|
||||
|
||||
class TestProfileSections(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/addon_3615',
|
||||
fixtures = ['base/users', 'base/addon_3615',
|
||||
'base/addon_5299_gcal', 'base/collections',
|
||||
'reviews/dev-reply']
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ class XPIForm(happyforms.Form):
|
|||
|
||||
for app in apps:
|
||||
av = ApplicationsVersions.objects.create(version=version,
|
||||
min=app.min, max=app.max, application_id=app.id)
|
||||
min=app.min, max=app.max, application=app.id)
|
||||
amo.log(amo.LOG.ADD_APPVERSION,
|
||||
version, version.addon, app.appdata.short, av)
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ class Version(amo.models.ModelBase):
|
|||
AV = ApplicationsVersions
|
||||
for app in data.get('apps', []):
|
||||
AV(version=v, min=app.min, max=app.max,
|
||||
application_id=app.id).save()
|
||||
application=app.id).save()
|
||||
if addon.type == amo.ADDON_SEARCH:
|
||||
# Search extensions are always for all platforms.
|
||||
platforms = [amo.PLATFORM_ALL.id]
|
||||
|
@ -244,9 +244,9 @@ class Version(amo.models.ModelBase):
|
|||
|
||||
The result is based on which app(s) the version targets.
|
||||
"""
|
||||
apps = set([a.application.id for a in self.apps.all()])
|
||||
targets_mobile = amo.MOBILE.id in apps
|
||||
targets_other = any((a != amo.MOBILE.id) for a in apps)
|
||||
app_ids = [a.application for a in self.apps.all()]
|
||||
targets_mobile = amo.MOBILE.id in app_ids
|
||||
targets_other = any((id_ != amo.MOBILE.id) for id_ in app_ids)
|
||||
all_plats = {}
|
||||
if targets_other:
|
||||
all_plats.update(amo.DESKTOP_PLATFORMS)
|
||||
|
@ -388,7 +388,7 @@ class Version(amo.models.ModelBase):
|
|||
def _compat_map(cls, avs):
|
||||
apps = {}
|
||||
for av in avs:
|
||||
app_id = av.application_id
|
||||
app_id = av.application
|
||||
if app_id in amo.APP_IDS:
|
||||
apps[amo.APP_IDS[app_id]] = av
|
||||
return apps
|
||||
|
@ -613,7 +613,7 @@ class VersionComment(amo.models.ModelBase):
|
|||
|
||||
class ApplicationsVersions(caching.base.CachingMixin, models.Model):
|
||||
|
||||
application = models.ForeignKey(Application)
|
||||
application = models.PositiveIntegerField(db_column='application_id')
|
||||
version = models.ForeignKey(Version, related_name='apps')
|
||||
min = models.ForeignKey(AppVersion, db_column='min',
|
||||
related_name='min_set')
|
||||
|
@ -626,9 +626,15 @@ class ApplicationsVersions(caching.base.CachingMixin, models.Model):
|
|||
db_table = u'applications_versions'
|
||||
unique_together = (("application", "version"),)
|
||||
|
||||
def get_application_display(self):
|
||||
return unicode(amo.APPS_ALL[self.application].pretty)
|
||||
|
||||
def __unicode__(self):
|
||||
if (self.version.is_compatible[0] and
|
||||
self.version.is_compatible_app(amo.APP_IDS[self.application.id])):
|
||||
return _(u'{app} {min} and later').format(app=self.application,
|
||||
min=self.min)
|
||||
return u'%s %s - %s' % (self.application, self.min, self.max)
|
||||
self.version.is_compatible_app(amo.APP_IDS[self.application])):
|
||||
return _(u'{app} {min} and later').format(
|
||||
app=self.get_application_display(),
|
||||
min=self.min
|
||||
)
|
||||
return u'%s %s - %s' % (self.get_application_display(),
|
||||
self.min, self.max)
|
||||
|
|
|
@ -22,7 +22,7 @@ from amo.tests import addon_factory
|
|||
from amo.urlresolvers import reverse
|
||||
from addons.models import Addon, CompatOverride, CompatOverrideRange
|
||||
from addons.tests.test_views import TestMobile
|
||||
from applications.models import AppVersion, Application
|
||||
from applications.models import AppVersion
|
||||
from devhub.models import ActivityLog
|
||||
from files.models import File
|
||||
from files.tests.test_models import UploadTest
|
||||
|
@ -85,7 +85,7 @@ def test_dict_from_int():
|
|||
|
||||
|
||||
class TestVersion(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_3615', 'base/admin']
|
||||
fixtures = ['base/addon_3615', 'base/admin']
|
||||
|
||||
def setUp(self):
|
||||
self.version = Version.objects.get(pk=81551)
|
||||
|
@ -94,7 +94,7 @@ class TestVersion(amo.tests.TestCase):
|
|||
return [amo.PLATFORMS[i].shortname for i in ids]
|
||||
|
||||
def target_mobile(self):
|
||||
app = Application.objects.get(pk=amo.MOBILE.id)
|
||||
app = amo.MOBILE.id
|
||||
app_vr = AppVersion.objects.create(application=app, version='1.0')
|
||||
ApplicationsVersions.objects.create(version=self.version,
|
||||
application=app,
|
||||
|
@ -390,22 +390,20 @@ class TestVersion(amo.tests.TestCase):
|
|||
eq_(version.is_compatible_app(amo.UNKNOWN_APP), False)
|
||||
|
||||
def test_compat_override_app_versions(self):
|
||||
app = Application.objects.get(pk=1)
|
||||
addon = Addon.objects.get(id=3615)
|
||||
version = amo.tests.version_factory(addon=addon)
|
||||
co = CompatOverride.objects.create(addon=addon)
|
||||
CompatOverrideRange.objects.create(compat=co, app=app, min_version='0',
|
||||
CompatOverrideRange.objects.create(compat=co, app=1, min_version='0',
|
||||
max_version=version.version,
|
||||
min_app_version='10.0a1',
|
||||
max_app_version='10.*')
|
||||
eq_(version.compat_override_app_versions(), [('10.0a1', '10.*')])
|
||||
|
||||
def test_compat_override_app_versions_wildcard(self):
|
||||
app = Application.objects.get(pk=1)
|
||||
addon = Addon.objects.get(id=3615)
|
||||
version = amo.tests.version_factory(addon=addon)
|
||||
co = CompatOverride.objects.create(addon=addon)
|
||||
CompatOverrideRange.objects.create(compat=co, app=app, min_version='0',
|
||||
CompatOverrideRange.objects.create(compat=co, app=1, min_version='0',
|
||||
max_version='*',
|
||||
min_app_version='10.0a1',
|
||||
max_app_version='10.*')
|
||||
|
@ -425,7 +423,7 @@ class TestVersion(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestViews(amo.tests.TestCase):
|
||||
fixtures = ['addons/eula+contrib-addon', 'base/apps']
|
||||
fixtures = ['addons/eula+contrib-addon']
|
||||
|
||||
def setUp(self):
|
||||
self.old_perpage = views.PER_PAGE
|
||||
|
@ -480,7 +478,7 @@ class TestViews(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestFeeds(amo.tests.TestCase):
|
||||
fixtures = ['addons/eula+contrib-addon', 'base/apps']
|
||||
fixtures = ['addons/eula+contrib-addon']
|
||||
|
||||
def test_feed_elements_present(self):
|
||||
"""specific elements are present and reasonably well formed"""
|
||||
|
@ -508,7 +506,7 @@ class TestFeeds(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestDownloadsBase(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_5299_gcal', 'base/users']
|
||||
fixtures = ['base/addon_5299_gcal', 'base/users']
|
||||
|
||||
def setUp(self):
|
||||
self.addon = Addon.objects.get(id=5299)
|
||||
|
@ -780,7 +778,7 @@ class TestDownloadSource(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestVersionFromUpload(UploadTest, amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_3615', 'base/users']
|
||||
fixtures = ['base/addon_3615', 'base/users']
|
||||
|
||||
def setUp(self):
|
||||
super(TestVersionFromUpload, self).setUp()
|
||||
|
@ -789,7 +787,7 @@ class TestVersionFromUpload(UploadTest, amo.tests.TestCase):
|
|||
self.addon.update(guid='guid@xpi')
|
||||
self.platform = amo.PLATFORM_MAC.id
|
||||
for version in ('3.0', '3.6.*'):
|
||||
AppVersion.objects.create(application_id=1, version=version)
|
||||
AppVersion.objects.create(application=1, version=version)
|
||||
|
||||
|
||||
class TestExtensionVersionFromUpload(TestVersionFromUpload):
|
||||
|
|
|
@ -19,7 +19,7 @@ from quieter_formset.formset import BaseModelFormSet
|
|||
import amo
|
||||
from addons.models import Addon
|
||||
from amo.urlresolvers import reverse
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from bandwagon.models import Collection, FeaturedCollection, MonthlyPick
|
||||
from compat.forms import CompatForm as BaseCompatForm
|
||||
from files.models import File
|
||||
|
@ -44,16 +44,17 @@ class DevMailerForm(happyforms.Form):
|
|||
|
||||
class BulkValidationForm(happyforms.ModelForm):
|
||||
application = forms.ChoiceField(
|
||||
label=_lazy(u'Application'),
|
||||
choices=[(a.id, a.pretty) for a in amo.APPS_ALL.values()])
|
||||
label=_lazy(u'Application'),
|
||||
choices=amo.APPS_CHOICES)
|
||||
curr_max_version = forms.ChoiceField(
|
||||
label=_lazy(u'Current Max. Version'),
|
||||
choices=[('', _lazy(u'Select an application first'))])
|
||||
label=_lazy(u'Current Max. Version'),
|
||||
choices=[('', _lazy(u'Select an application first'))])
|
||||
target_version = forms.ChoiceField(
|
||||
label=_lazy(u'Target Version'),
|
||||
choices=[('', _lazy(u'Select an application first'))])
|
||||
finish_email = forms.CharField(required=False,
|
||||
label=_lazy(u'Email when finished'))
|
||||
label=_lazy(u'Target Version'),
|
||||
choices=[('', _lazy(u'Select an application first'))])
|
||||
finish_email = forms.CharField(
|
||||
required=False,
|
||||
label=_lazy(u'Email when finished'))
|
||||
|
||||
class Meta:
|
||||
model = ValidationJob
|
||||
|
@ -69,13 +70,12 @@ class BulkValidationForm(happyforms.ModelForm):
|
|||
w.attrs['data-url'] = reverse('zadmin.application_versions_json')
|
||||
|
||||
def version_choices_for_app_id(self, app_id):
|
||||
versions = AppVersion.objects.filter(application__id=app_id)
|
||||
versions = AppVersion.objects.filter(application=app_id)
|
||||
return [(v.id, v.version) for v in versions]
|
||||
|
||||
def clean_application(self):
|
||||
app_id = int(self.cleaned_data['application'])
|
||||
app = Application.objects.get(pk=app_id)
|
||||
self.cleaned_data['application'] = app
|
||||
self.cleaned_data['application'] = app_id
|
||||
choices = self.version_choices_for_app_id(app_id)
|
||||
self.fields['target_version'].choices = choices
|
||||
self.fields['curr_max_version'].choices = choices
|
||||
|
@ -136,7 +136,11 @@ class FeaturedCollectionForm(happyforms.ModelForm):
|
|||
(i, product_details.languages[i]['native'])
|
||||
for i in settings.AMO_LANGUAGES)
|
||||
|
||||
application = forms.ModelChoiceField(Application.objects.all())
|
||||
application = forms.ChoiceField(
|
||||
amo.APPS_CHOICES,
|
||||
error_messages={'invalid_choice': _lazy(u'Select a valid choice. That '
|
||||
u'choice is not one of the '
|
||||
u'available choices.')})
|
||||
collection = forms.CharField(widget=forms.HiddenInput)
|
||||
locale = forms.ChoiceField(choices=LOCALES, required=False)
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from django.utils.functional import memoize
|
|||
import amo
|
||||
import amo.models
|
||||
from amo.urlresolvers import reverse
|
||||
from applications.models import Application, AppVersion
|
||||
from applications.models import AppVersion
|
||||
from files.models import File
|
||||
|
||||
_config_cache = {}
|
||||
|
@ -49,7 +49,7 @@ def set_config(conf, value):
|
|||
|
||||
|
||||
class ValidationJob(amo.models.ModelBase):
|
||||
application = models.ForeignKey(Application)
|
||||
application = models.PositiveIntegerField(db_column='application_id')
|
||||
curr_max_version = models.ForeignKey(AppVersion,
|
||||
related_name='validation_current_set')
|
||||
target_version = models.ForeignKey(AppVersion,
|
||||
|
|
|
@ -67,7 +67,7 @@ def tally_job_results(job_id, **kw):
|
|||
job.update(completed=datetime.now())
|
||||
if job.finish_email:
|
||||
send_mail(u'Behold! Validation results for %s %s->%s'
|
||||
% (amo.APP_IDS[job.application.id].pretty,
|
||||
% (amo.APP_IDS[job.application].pretty,
|
||||
job.curr_max_version.version,
|
||||
job.target_version.version),
|
||||
textwrap.dedent("""
|
||||
|
@ -89,15 +89,14 @@ def bulk_validate_file(result_id, **kw):
|
|||
log.info('[1@None] Validating file %s (%s) for result_id %s'
|
||||
% (res.file, file_base, res.id))
|
||||
target = res.validation_job.target_version
|
||||
ver = {target.application.guid: [target.version]}
|
||||
guid = amo.APP_IDS[target.application].guid
|
||||
ver = {guid: [target.version]}
|
||||
# Set min/max so the validator only tests for compatibility with
|
||||
# the target version. Note that previously we explicitly checked
|
||||
# for compatibility with older versions. See bug 675306 for
|
||||
# the old behavior.
|
||||
overrides = {'targetapp_minVersion':
|
||||
{target.application.guid: target.version},
|
||||
'targetapp_maxVersion':
|
||||
{target.application.guid: target.version}}
|
||||
overrides = {'targetapp_minVersion': {guid: target.version},
|
||||
'targetapp_maxVersion': {guid: target.version}}
|
||||
validation = run_validator(res.file.file_path, for_appversions=ver,
|
||||
test_all_tiers=True, overrides=overrides,
|
||||
compat=True)
|
||||
|
@ -148,7 +147,7 @@ def add_validation_jobs(pks, job_pk, **kw):
|
|||
prelim_app = list(amo.UNDER_REVIEW_STATUSES) + [amo.STATUS_BETA]
|
||||
for addon in Addon.objects.filter(pk__in=pks):
|
||||
ids = []
|
||||
base = addon.versions.filter(apps__application=job.application.id,
|
||||
base = addon.versions.filter(apps__application=job.application,
|
||||
apps__max__version_int__gte=curr_ver,
|
||||
apps__max__version_int__lt=target_ver)
|
||||
|
||||
|
@ -159,7 +158,7 @@ def add_validation_jobs(pks, job_pk, **kw):
|
|||
log.info('Addon %s already has a public version %r which is '
|
||||
'compatible with target version of app %s %s (or newer)'
|
||||
% (addon.pk, [v.pk for v in already_compat.all()],
|
||||
job.application.id, job.target_version))
|
||||
job.application, job.target_version))
|
||||
continue
|
||||
|
||||
try:
|
||||
|
@ -226,7 +225,7 @@ def update_maxversions(version_pks, job_pk, data, **kw):
|
|||
job = ValidationJob.objects.get(pk=job_pk)
|
||||
set_user(get_task_user())
|
||||
dry_run = data['preview_only']
|
||||
app_id = job.target_version.application.pk
|
||||
app_id = job.target_version.application
|
||||
stats = collections.defaultdict(int)
|
||||
stats['processed'] = 0
|
||||
stats['is_dry_run'] = int(dry_run)
|
||||
|
@ -278,7 +277,7 @@ def notify_compatibility(users, job, data, **kw):
|
|||
% (len(users), notify_compatibility.rate_limit, job.pk))
|
||||
set_user(get_task_user())
|
||||
dry_run = data['preview_only']
|
||||
app_id = job.target_version.application.pk
|
||||
app_id = job.target_version.application
|
||||
stats = collections.defaultdict(int)
|
||||
stats['processed'] = 0
|
||||
stats['is_dry_run'] = int(dry_run)
|
||||
|
@ -307,7 +306,7 @@ def notify_compatibility(users, job, data, **kw):
|
|||
|
||||
|
||||
context = Context({
|
||||
'APPLICATION': str(job.application),
|
||||
'APPLICATION': unicode(amo.APP_IDS[job.application].pretty),
|
||||
'VERSION': job.target_version.version,
|
||||
'PASSING_ADDONS': user.passing_addons,
|
||||
'FAILING_ADDONS': user.failing_addons,
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<td>{{ job.pk }}</td>
|
||||
<td>{{ job.created }}</td>
|
||||
<td class="tests-finished">{{ job.completed }}</td>
|
||||
<td>{{ amo.APPS_ALL[job.application.id].pretty }}</td>
|
||||
<td>{{ amo.APPS_ALL[job.application].pretty }}</td>
|
||||
<td>{{ job.curr_max_version.version }}</td>
|
||||
<td>{{ job.target_version.version }}</td>
|
||||
<td class="tested">{{ job.stats['total'] }}</td>
|
||||
|
|
|
@ -143,7 +143,7 @@ class TestFlagged(amo.tests.TestCase):
|
|||
|
||||
|
||||
class BulkValidationTest(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/addon_3615', 'base/appversion', 'base/users']
|
||||
fixtures = ['base/addon_3615', 'base/appversion', 'base/users']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='admin@mozilla.com',
|
||||
|
@ -172,7 +172,7 @@ class BulkValidationTest(amo.tests.TestCase):
|
|||
version=version)
|
||||
|
||||
def create_job(self, **kwargs):
|
||||
kw = dict(application_id=amo.FIREFOX.id,
|
||||
kw = dict(application=amo.FIREFOX.id,
|
||||
curr_max_version=kwargs.pop('current', self.curr_max),
|
||||
target_version=kwargs.pop('target',
|
||||
self.appversion('3.7a3')),
|
||||
|
@ -228,7 +228,7 @@ class TestBulkValidation(BulkValidationTest):
|
|||
self.assertNoFormErrors(r)
|
||||
self.assertRedirects(r, reverse('zadmin.validation'))
|
||||
job = ValidationJob.objects.get()
|
||||
eq_(job.application_id, amo.FIREFOX.id)
|
||||
eq_(job.application, amo.FIREFOX.id)
|
||||
eq_(job.curr_max_version.version, self.curr_max.version)
|
||||
eq_(job.target_version.version, new_max.version)
|
||||
eq_(job.finish_email, 'fliggy@mozilla.com')
|
||||
|
@ -378,7 +378,7 @@ class TestBulkUpdate(BulkValidationTest):
|
|||
appver = AppVersion.objects.get(application=1, version='3.7a1pre')
|
||||
for v in self.version_one, self.version_two:
|
||||
ApplicationsVersions.objects.create(
|
||||
application_id=amo.FIREFOX.id, version=v,
|
||||
application=amo.FIREFOX.id, version=v,
|
||||
min=appver, max=appver)
|
||||
|
||||
def test_no_update_link(self):
|
||||
|
@ -478,7 +478,7 @@ class TestBulkUpdate(BulkValidationTest):
|
|||
def test_update_different_app(self):
|
||||
self.create_result(self.job, self.create_file(self.version))
|
||||
target = self.version.apps.all()[0]
|
||||
target.application_id = amo.FIREFOX.id
|
||||
target.application = amo.FIREFOX.id
|
||||
target.save()
|
||||
eq_(self.version.apps.all()[0].max, self.curr_max)
|
||||
|
||||
|
@ -1151,7 +1151,7 @@ class TestEmailPreview(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestMonthlyPick(amo.tests.TestCase):
|
||||
fixtures = ['base/addon_3615', 'base/apps', 'base/users']
|
||||
fixtures = ['base/addon_3615', 'base/users']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='admin@mozilla.com',
|
||||
|
@ -1225,14 +1225,13 @@ class TestMonthlyPick(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestFeatures(amo.tests.TestCase):
|
||||
fixtures = ['base/apps', 'base/users', 'base/collections',
|
||||
'base/addon_3615.json']
|
||||
fixtures = ['base/users', 'base/collections', 'base/addon_3615.json']
|
||||
|
||||
def setUp(self):
|
||||
assert self.client.login(username='admin@mozilla.com',
|
||||
password='password')
|
||||
self.url = reverse('zadmin.features')
|
||||
FeaturedCollection.objects.create(application_id=amo.FIREFOX.id,
|
||||
FeaturedCollection.objects.create(application=amo.FIREFOX.id,
|
||||
locale='zh-CN', collection_id=80)
|
||||
self.f = self.client.get(self.url).context['form'].initial_forms[0]
|
||||
self.initial = self.f.initial
|
||||
|
@ -1716,7 +1715,7 @@ class TestCompat(amo.tests.ESTestCase):
|
|||
# Add an override for this current app version.
|
||||
compat = CompatOverride.objects.create(addon=addon, guid=addon.guid)
|
||||
CompatOverrideRange.objects.create(compat=compat,
|
||||
app_id=amo.FIREFOX.id, min_app_version=self.app_version + 'a1',
|
||||
app=amo.FIREFOX.id, min_app_version=self.app_version + 'a1',
|
||||
max_app_version=self.app_version + '*')
|
||||
|
||||
# Check that there is an override for this current app version.
|
||||
|
@ -1892,7 +1891,7 @@ class TestEmailDevs(amo.tests.TestCase):
|
|||
|
||||
|
||||
class TestPerms(amo.tests.TestCase):
|
||||
fixtures = ['base/users', 'base/apps', 'zadmin/tests/flagged']
|
||||
fixtures = ['base/users', 'zadmin/tests/flagged']
|
||||
|
||||
def test_admin_user(self):
|
||||
# Admin should see views with Django's perm decorator and our own.
|
||||
|
|
|
@ -225,7 +225,7 @@ def find_files(job):
|
|||
addons = (Addon.objects.filter(
|
||||
status__in=amo.VALID_STATUSES,
|
||||
disabled_by_user=False,
|
||||
versions__apps__application=job.application.id,
|
||||
versions__apps__application=job.application,
|
||||
versions__apps__max__version_int__gte=current,
|
||||
versions__apps__max__version_int__lt=target)
|
||||
# Exclude lang packs and themes.
|
||||
|
|
|
@ -1066,7 +1066,7 @@ CUSTOM_DUMPS = {
|
|||
'current_version.apps.all.0',
|
||||
'addonuser_set.all.0',
|
||||
],
|
||||
'order': ('applications.application', 'translations.translation',
|
||||
'order': ('translations.translation',
|
||||
'files.platform', 'addons.addon',
|
||||
'versions.license', 'versions.version', 'files.file'),
|
||||
'excludes': {
|
||||
|
|
|
@ -146,8 +146,7 @@ class Update(object):
|
|||
sql = ["""
|
||||
SELECT
|
||||
addons.guid as guid, addons.addontype_id as type,
|
||||
addons.inactive as disabled_by_user,
|
||||
applications.guid as appguid, appmin.version as min,
|
||||
addons.inactive as disabled_by_user, appmin.version as min,
|
||||
appmax.version as max, files.id as file_id,
|
||||
files.status as file_status, files.hash,
|
||||
files.filename, versions.id as version_id,
|
||||
|
@ -160,13 +159,12 @@ class Update(object):
|
|||
ON addons.id = versions.addon_id AND addons.id = %(id)s
|
||||
INNER JOIN applications_versions
|
||||
ON applications_versions.version_id = versions.id
|
||||
INNER JOIN applications
|
||||
ON applications_versions.application_id = applications.id
|
||||
AND applications.id = %(app_id)s
|
||||
INNER JOIN appversions appmin
|
||||
ON appmin.id = applications_versions.min
|
||||
AND appmin.application_id = %(app_id)s
|
||||
INNER JOIN appversions appmax
|
||||
ON appmax.id = applications_versions.max
|
||||
AND appmax.application_id = %(app_id)s
|
||||
INNER JOIN files
|
||||
ON files.version_id = versions.id AND (files.platform_id = 1
|
||||
"""]
|
||||
|
@ -283,7 +281,7 @@ class Update(object):
|
|||
|
||||
if result:
|
||||
row = dict(zip([
|
||||
'guid', 'type', 'disabled_by_user', 'appguid', 'min', 'max',
|
||||
'guid', 'type', 'disabled_by_user', 'min', 'max',
|
||||
'file_id', 'file_status', 'hash', 'filename', 'version_id',
|
||||
'datestatuschanged', 'strict_compat', 'releasenotes',
|
||||
'version', 'premium_type'],
|
||||
|
@ -291,6 +289,7 @@ class Update(object):
|
|||
row['type'] = base.ADDON_SLUGS_UPDATE[row['type']]
|
||||
row['url'] = get_mirror(data['addon_status'],
|
||||
data['id'], row)
|
||||
row['appguid'] = applications.APPS_ALL[data['app_id']].guid
|
||||
data['row'] = row
|
||||
return True
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче