Merge lp:~michael.nelson/ubuntu-webcatalog/987838-no-screenshot-for-extras into lp:ubuntu-webcatalog

Proposed by Michael Nelson
Status: Merged
Approved by: Łukasz Czyżykowski
Approved revision: 120
Merged at revision: 118
Proposed branch: lp:~michael.nelson/ubuntu-webcatalog/987838-no-screenshot-for-extras
Merge into: lp:ubuntu-webcatalog
Diff against target: 38 lines (+15/-2)
2 files modified
src/webcatalog/tests/test_views.py (+14/-0)
src/webcatalog/views.py (+1/-2)
To merge this branch: bzr merge lp:~michael.nelson/ubuntu-webcatalog/987838-no-screenshot-for-extras
Reviewer Review Type Date Requested Status
Łukasz Czyżykowski (community) Approve
Review via email: mp+104876@code.launchpad.net

Commit message

application_screenshots no longer dependent on redundant data (is_latest).

Description of the change

Ensures that the application_screenshots view is not dependent on redundant data (is_latest).

Another part of the fix for this should be ensuring that the check_all_latest command is run after each import (import_app_install_data and import_for_purchase), but I want to check with achuni about that first as it looks like the kind of command we wouldn't want to run unnecessarily (ie. after each import of a distroseries, but rather after importing all distroseries - which may be why it's been left manual).

`fab test`

To post a comment you must log in.
Revision history for this message
Łukasz Czyżykowski (lukasz-czyzykowski) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/webcatalog/tests/test_views.py'
2--- src/webcatalog/tests/test_views.py 2012-05-04 10:20:34 +0000
3+++ src/webcatalog/tests/test_views.py 2012-05-07 09:12:19 +0000
4@@ -1065,6 +1065,20 @@
5
6 self.assertEqual(200, response.status_code)
7
8+ @patch('webcatalog.utilities.urllib.urlopen')
9+ def test_not_dependent_on_is_latest(self, mock_urlopen):
10+ lucid = self.factory.make_distroseries(code_name='lucid')
11+ maverick = self.factory.make_distroseries(code_name='maverick')
12+ self.factory.make_application(package_name='foo', distroseries=lucid,
13+ is_latest=False)
14+ self.factory.make_application(package_name='foo',
15+ distroseries=maverick, is_latest=False)
16+
17+ response = self.client.get(reverse('wc-package-screenshots',
18+ args=['foo']))
19+
20+ self.assertEqual(200, response.status_code)
21+
22
23 class ApplicationRecommendsTestCase(TestCaseWithFactory):
24
25
26=== modified file 'src/webcatalog/views.py'
27--- src/webcatalog/views.py 2012-04-20 16:57:50 +0000
28+++ src/webcatalog/views.py 2012-05-07 09:12:19 +0000
29@@ -233,8 +233,7 @@
30
31
32 def application_screenshots(request, package_name):
33- app = get_object_or_404(Application, package_name=package_name,
34- is_latest=True)
35+ app = Application.objects.find_best_or_404(package_name=package_name)
36 screenshots = WebServices().get_screenshots_for_package(package_name)
37 return HttpResponse(json.dumps(screenshots),
38 mimetype='application/json')

Subscribers

People subscribed via source and target branches