make statuses a tuple of id, status (bug 690523)

This commit is contained in:
Andy McKay 2011-10-03 11:18:34 -07:00
Родитель 681bcbfad2
Коммит c4ec669dbd
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -43,6 +43,7 @@ from amo.urlresolvers import reverse
from api.authentication import AMOOAuthAuthentication
from addons.models import Addon, AddonUser, BlacklistedGuid
from devhub.models import ActivityLog, SubmitStep
from files.models import File
from perf.models import (Performance, PerformanceAppVersions,
PerformanceOSVersion)
from test_utils import RequestFactory
@ -643,7 +644,8 @@ class TestAddon(BaseOAuth):
a = Addon.objects.get(pk=data['id'])
r = client.get(('api.version', data['id'], a.versions.get().id),
self.accepted_consumer, self.token)
eq_(json.loads(r.content)['statuses'], [1])
eq_(json.loads(r.content)['statuses'],
[[File.objects.all()[0].pk, 1]])
@patch('access.acl.check_addon_ownership')
def test_not_my_addon(self, acl):

Просмотреть файл

@ -218,7 +218,7 @@ class Version(amo.models.ModelBase):
@property
def statuses(self):
"""Unadulterated statuses, good for an API."""
return [f.status for f in self.all_files]
return [(f.id, f.status) for f in self.all_files]
def is_allowed_upload(self):
"""Check that a file can be uploaded based on the files