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
=== modified file 'src/webcatalog/management/commands/import_app_install_data.py'
--- src/webcatalog/management/commands/import_app_install_data.py 2012-01-06 17:54:47 +0000
+++ src/webcatalog/management/commands/import_app_install_data.py 2012-03-05 10:36:18 +0000
@@ -89,6 +89,11 @@
8989
90 cache = self.get_apt_cache()90 cache = self.get_apt_cache()
91 try:91 try:
92 # XXX michaeln bug=879268 Lucid doesnt know about translations.
93 # As long as our server is running on Lucid, we need to ensure
94 # that apt is configured to download package translations,
95 # even though on Lucid they'd normally not be necessary.
96 apt.apt_pkg.config.set("APT::Acquire::Translation", "en")
92 cache.update()97 cache.update()
93 except FetchFailedException:98 except FetchFailedException:
94 # Make sure __exit__ still gets called99 # Make sure __exit__ still gets called
95100
=== modified file 'src/webcatalog/tests/test_commands.py'
--- src/webcatalog/tests/test_commands.py 2012-01-06 17:54:47 +0000
+++ src/webcatalog/tests/test_commands.py 2012-03-05 10:36:18 +0000
@@ -64,6 +64,12 @@
6464
65class ImportAppInstallTestCase(TestCaseWithFactory):65class ImportAppInstallTestCase(TestCaseWithFactory):
6666
67 FIREFOX_DESCRIPTION = (
68 u'Firefox delivers safe, easy web browsing. A familiar user '
69 u'interface, enhanced security features including protection '
70 u'from online identity theft, and integrated search let you '
71 u'get the most out of the web.')
72
67 # If you want to run these tests against the real apt cache (which73 # If you want to run these tests against the real apt cache (which
68 # is slower, but the real deal) you can update the following74 # is slower, but the real deal) you can update the following
69 # attribute. Note: 3 tests will fail which make assumptions about75 # attribute. Note: 3 tests will fail which make assumptions about
@@ -88,7 +94,7 @@
88 """94 """
89 mock_cache = MagicMock()95 mock_cache = MagicMock()
90 mock_apt_firefox = self.make_mock_apt_package('firefox',96 mock_apt_firefox = self.make_mock_apt_package('firefox',
91 description="Firefox description")97 description=self.FIREFOX_DESCRIPTION)
92 mock_apt_scribus = self.make_mock_apt_package('scribus',98 mock_apt_scribus = self.make_mock_apt_package('scribus',
93 description="Scribus description")99 description="Scribus description")
94 mock_other_app = self.make_mock_apt_package('otherapp',100 mock_other_app = self.make_mock_apt_package('otherapp',
@@ -279,7 +285,7 @@
279 self.assertEqual(4, Application.objects.count())285 self.assertEqual(4, Application.objects.count())
280 firefox = Application.objects.get(package_name='firefox')286 firefox = Application.objects.get(package_name='firefox')
281 scribus = Application.objects.get(package_name='scribus')287 scribus = Application.objects.get(package_name='scribus')
282 self.assertEqual("Firefox description", firefox.description)288 self.assertEqual(self.FIREFOX_DESCRIPTION, firefox.description)
283 self.assertEqual("Scribus description", scribus.description)289 self.assertEqual("Scribus description", scribus.description)
284 # The name and comment come directly from the desktop file when290 # The name and comment come directly from the desktop file when
285 # it exists.291 # it exists.
@@ -373,6 +379,21 @@
373 self.assertEqual('Otherapp the Internet', otherapp.name)379 self.assertEqual('Otherapp the Internet', otherapp.name)
374 self.assertEqual('A tagline for Otherapp', otherapp.comment)380 self.assertEqual('A tagline for Otherapp', otherapp.comment)
375381
382 def test_lang_specific_description_added_to_app(self):
383 # Related to bug 879268 - our app server runs on lucid where
384 # python-apt doesn't support language-specific descriptions
385 # which have been used since oneiric.
386 self.assertEqual(0, Application.objects.count())
387
388 call_command(
389 'import_app_install_data', 'precise',
390 local_app_install_deb=self.factory.get_test_path(
391 'app-install-data-test_all.deb'),
392 verbosity=0)
393
394 firefox = Application.objects.get(package_name='firefox')
395 self.assertEqual(self.FIREFOX_DESCRIPTION, firefox.description)
396
376397
377class ImportForPurchaseAppsTestCase(TestCaseWithFactory):398class ImportForPurchaseAppsTestCase(TestCaseWithFactory):
378399

Subscribers

People subscribed via source and target branches