← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~henninge/launchpad/devel-741571-db-permissions into lp:launchpad

 

Henning Eggers has proposed merging lp:~henninge/launchpad/devel-741571-db-permissions into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #742309 in Launchpad itself: "Missing db permissions for soyuz translation uploads."
  https://bugs.launchpad.net/launchpad/+bug/742309

For more details, see:
https://code.launchpad.net/~henninge/launchpad/devel-741571-db-permissions/+merge/54823

Database permission fix. The test needed to be moved to a different layer to support dbuesr switches.
-- 
https://code.launchpad.net/~henninge/launchpad/devel-741571-db-permissions/+merge/54823
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~henninge/launchpad/devel-741571-db-permissions into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg	2011-03-24 14:13:45 +0000
+++ database/schema/security.cfg	2011-03-25 09:14:31 +0000
@@ -1437,6 +1437,7 @@
 public.libraryfilecontent               = SELECT, INSERT
 
 # rosetta auto imports
+public.packaging                        = SELECT
 public.pofile                           = SELECT
 public.potemplate                       = SELECT
 public.translationgroup                 = SELECT

=== modified file 'lib/lp/soyuz/tests/test_sourcepackagerelease.py'
--- lib/lp/soyuz/tests/test_sourcepackagerelease.py	2011-03-24 11:37:08 +0000
+++ lib/lp/soyuz/tests/test_sourcepackagerelease.py	2011-03-25 09:14:31 +0000
@@ -8,12 +8,16 @@
 import transaction
 from zope.component import getUtility
 
-from canonical.testing.layers import LaunchpadFunctionalLayer
+from canonical.testing.layers import (
+    LaunchpadFunctionalLayer,
+    LaunchpadZopelessLayer,
+    )
 from lp.services.tarfile_helpers import LaunchpadWriteTarFile
 from lp.testing import (
     TestCaseWithFactory,
     person_logged_in,
     )
+from lp.testing.dbuser import dbuser
 from lp.translations.interfaces.translationimportqueue import (
     ITranslationImportQueue,
     )
@@ -65,6 +69,12 @@
         spr = self.factory.makeSourcePackageRelease(homepage="<invalid<url")
         self.assertEquals("<invalid<url", spr.homepage)
 
+
+class TestSourcePackageReleaseTranslationFeiles(TestCaseWithFactory):
+    """Tests for attachTranslationFiles on a different layer."""
+
+    layer = LaunchpadZopelessLayer
+
     def makeTranslationsLFA(self):
         """Create an LibraryFileAlias containing dummy translation data."""
         test_tar_content = {
@@ -83,7 +93,8 @@
         self.assertFalse(spr.sourcepackage.has_sharing_translation_templates)
         lfa = self.makeTranslationsLFA()
         transaction.commit()
-        spr.attachTranslationFiles(lfa, True, spr.maintainer)
+        with dbuser('queued'):
+            spr.attachTranslationFiles(lfa, True, spr.maintainer)
         translation_import_queue = getUtility(ITranslationImportQueue)
         entries_in_queue = translation_import_queue.getAllEntries(
                 target=spr.sourcepackage).count()
@@ -103,7 +114,8 @@
         self.assertTrue(sourcepackage.has_sharing_translation_templates)
         lfa = self.makeTranslationsLFA()
         transaction.commit()
-        spr.attachTranslationFiles(lfa, True, spr.maintainer)
+        with dbuser('queued'):
+            spr.attachTranslationFiles(lfa, True, spr.maintainer)
         translation_import_queue = getUtility(ITranslationImportQueue)
         entries = translation_import_queue.getAllEntries(
                 target=sourcepackage)