Merge lp:~michael.nelson/ubuntu-webcatalog/879268-language-specific-descriptions into lp:ubuntu-webcatalog

Proposed by Michael Nelson
Status: Merged
Approved by: Łukasz Czyżykowski
Approved revision: 66
Merged at revision: 64
Proposed branch: lp:~michael.nelson/ubuntu-webcatalog/879268-language-specific-descriptions
Merge into: lp:ubuntu-webcatalog
Diff against target: 71 lines (+28/-2)
2 files modified
src/webcatalog/management/commands/import_app_install_data.py (+5/-0)
src/webcatalog/tests/test_commands.py (+23/-2)
To merge this branch: bzr merge lp:~michael.nelson/ubuntu-webcatalog/879268-language-specific-descriptions
Reviewer Review Type Date Requested Status
Łukasz Czyżykowski (community) Approve
Review via email: mp+95401@code.launchpad.net

Commit message

Force lucid to use package translations.

Description of the change

Overview
========

This branch updates the apt-cache that we configure so that it *always* downloads the translations, even when on lucid where it thinks it shouldn't need to (as normally lucid packages file contains descriptions etc.)

Thanks to mvo for the fix.

To test:
 1) setup a dev env on a lucid box,
 2) update the ImportAppInstallTestCase.use_mock_apt_cache class variable to true, and then:
 3) fab test:webcatalog.ImportAppInstallTestCase.test_lang_specific_description_added_to_app

which will fail on r62, but pass for > r62.

To post a comment you must log in.
66. By Michael Nelson

DRYd up firefox description.

Revision history for this message
Łukasz Czyżykowski (lukasz-czyzykowski) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/webcatalog/management/commands/import_app_install_data.py'
2--- src/webcatalog/management/commands/import_app_install_data.py 2012-01-06 17:54:47 +0000
3+++ src/webcatalog/management/commands/import_app_install_data.py 2012-03-05 10:36:18 +0000
4@@ -89,6 +89,11 @@
5
6 cache = self.get_apt_cache()
7 try:
8+ # XXX michaeln bug=879268 Lucid doesnt know about translations.
9+ # As long as our server is running on Lucid, we need to ensure
10+ # that apt is configured to download package translations,
11+ # even though on Lucid they'd normally not be necessary.
12+ apt.apt_pkg.config.set("APT::Acquire::Translation", "en")
13 cache.update()
14 except FetchFailedException:
15 # Make sure __exit__ still gets called
16
17=== modified file 'src/webcatalog/tests/test_commands.py'
18--- src/webcatalog/tests/test_commands.py 2012-01-06 17:54:47 +0000
19+++ src/webcatalog/tests/test_commands.py 2012-03-05 10:36:18 +0000
20@@ -64,6 +64,12 @@
21
22 class ImportAppInstallTestCase(TestCaseWithFactory):
23
24+ FIREFOX_DESCRIPTION = (
25+ u'Firefox delivers safe, easy web browsing. A familiar user '
26+ u'interface, enhanced security features including protection '
27+ u'from online identity theft, and integrated search let you '
28+ u'get the most out of the web.')
29+
30 # If you want to run these tests against the real apt cache (which
31 # is slower, but the real deal) you can update the following
32 # attribute. Note: 3 tests will fail which make assumptions about
33@@ -88,7 +94,7 @@
34 """
35 mock_cache = MagicMock()
36 mock_apt_firefox = self.make_mock_apt_package('firefox',
37- description="Firefox description")
38+ description=self.FIREFOX_DESCRIPTION)
39 mock_apt_scribus = self.make_mock_apt_package('scribus',
40 description="Scribus description")
41 mock_other_app = self.make_mock_apt_package('otherapp',
42@@ -279,7 +285,7 @@
43 self.assertEqual(4, Application.objects.count())
44 firefox = Application.objects.get(package_name='firefox')
45 scribus = Application.objects.get(package_name='scribus')
46- self.assertEqual("Firefox description", firefox.description)
47+ self.assertEqual(self.FIREFOX_DESCRIPTION, firefox.description)
48 self.assertEqual("Scribus description", scribus.description)
49 # The name and comment come directly from the desktop file when
50 # it exists.
51@@ -373,6 +379,21 @@
52 self.assertEqual('Otherapp the Internet', otherapp.name)
53 self.assertEqual('A tagline for Otherapp', otherapp.comment)
54
55+ def test_lang_specific_description_added_to_app(self):
56+ # Related to bug 879268 - our app server runs on lucid where
57+ # python-apt doesn't support language-specific descriptions
58+ # which have been used since oneiric.
59+ self.assertEqual(0, Application.objects.count())
60+
61+ call_command(
62+ 'import_app_install_data', 'precise',
63+ local_app_install_deb=self.factory.get_test_path(
64+ 'app-install-data-test_all.deb'),
65+ verbosity=0)
66+
67+ firefox = Application.objects.get(package_name='firefox')
68+ self.assertEqual(self.FIREFOX_DESCRIPTION, firefox.description)
69+
70
71 class ImportForPurchaseAppsTestCase(TestCaseWithFactory):
72

Subscribers

People subscribed via source and target branches