From c4ec669dbd7ef224a08eadd8df5a4722fdf500b8 Mon Sep 17 00:00:00 2001 From: Andy McKay Date: Mon, 3 Oct 2011 11:18:34 -0700 Subject: [PATCH] make statuses a tuple of id, status (bug 690523) --- apps/api/tests/test_oauth.py | 4 +++- apps/versions/models.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/api/tests/test_oauth.py b/apps/api/tests/test_oauth.py index c19a295d9b..06cd81b93c 100644 --- a/apps/api/tests/test_oauth.py +++ b/apps/api/tests/test_oauth.py @@ -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): diff --git a/apps/versions/models.py b/apps/versions/models.py index a6a704b5ee..ddf2b109ad 100644 --- a/apps/versions/models.py +++ b/apps/versions/models.py @@ -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