Merge lp:~thumper/launchpad/scanner-permissions into lp:launchpad

Proposed by Tim Penhey
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: no longer in the source branch.
Merged at revision: 11525
Proposed branch: lp:~thumper/launchpad/scanner-permissions
Merge into: lp:launchpad
Diff against target: 61 lines (+13/-0)
3 files modified
database/schema/security.cfg (+1/-0)
lib/lp/codehosting/scanner/tests/test_buglinks.py (+9/-0)
lib/lp/codehosting/scanner/tests/test_bzrsync.py (+3/-0)
To merge this branch: bzr merge lp:~thumper/launchpad/scanner-permissions
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+35048@code.launchpad.net

Commit message

Fix the db permissions for updating bugheat from the scanner when linking branches.

Description of the change

A new corner case found in the branch scanner for updating bug heat.

This was not caught as the tests were not testing all the possible bug tasks being updated from the scanner.

Tests:
  TestBugLinking

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Implicit set up in the tests is a bit horrid, but that's not to be fixed in a CP branch I guess :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2010-09-03 16:43:11 +0000
+++ database/schema/security.cfg 2010-09-10 02:48:47 +0000
@@ -593,6 +593,7 @@
593public.diff = SELECT, INSERT, DELETE593public.diff = SELECT, INSERT, DELETE
594public.distroseries = SELECT594public.distroseries = SELECT
595public.distribution = SELECT595public.distribution = SELECT
596public.distributionsourcepackage = SELECT, UPDATE
596public.emailaddress = SELECT597public.emailaddress = SELECT
597public.job = SELECT, INSERT, UPDATE, DELETE598public.job = SELECT, INSERT, UPDATE, DELETE
598# Karma599# Karma
599600
=== modified file 'lib/lp/codehosting/scanner/tests/test_buglinks.py'
--- lib/lp/codehosting/scanner/tests/test_buglinks.py 2010-08-20 20:31:18 +0000
+++ lib/lp/codehosting/scanner/tests/test_buglinks.py 2010-09-10 02:48:47 +0000
@@ -12,6 +12,7 @@
12from bzrlib.revision import Revision12from bzrlib.revision import Revision
13from zope.component import getUtility13from zope.component import getUtility
14from zope.event import notify14from zope.event import notify
15from zope.security.proxy import removeSecurityProxy
1516
16from canonical.config import config17from canonical.config import config
17from canonical.launchpad.interfaces import (18from canonical.launchpad.interfaces import (
@@ -120,8 +121,16 @@
120 def makeFixtures(self):121 def makeFixtures(self):
121 super(TestBugLinking, self).makeFixtures()122 super(TestBugLinking, self).makeFixtures()
122 self.bug1 = self.factory.makeBug()123 self.bug1 = self.factory.makeBug()
124 sp = self.factory.makeSourcePackage()
125 self.bug1.addTask(self.bug1.owner, sp)
126 dsp = self.factory.makeDistributionSourcePackage()
127 self.bug1.addTask(self.bug1.owner, dsp)
128 distro = self.factory.makeDistribution()
129 self.bug1.addTask(self.bug1.owner, distro)
123 self.bug2 = self.factory.makeBug()130 self.bug2 = self.factory.makeBug()
124 self.new_db_branch = self.factory.makeAnyBranch()131 self.new_db_branch = self.factory.makeAnyBranch()
132 removeSecurityProxy(distro).max_bug_heat = 0;
133 removeSecurityProxy(dsp).max_bug_heat = 0;
125 self.layer.txn.commit()134 self.layer.txn.commit()
126135
127 def getBugURL(self, bug):136 def getBugURL(self, bug):
128137
=== modified file 'lib/lp/codehosting/scanner/tests/test_bzrsync.py'
--- lib/lp/codehosting/scanner/tests/test_bzrsync.py 2010-08-20 20:31:18 +0000
+++ lib/lp/codehosting/scanner/tests/test_bzrsync.py 2010-09-10 02:48:47 +0000
@@ -20,6 +20,7 @@
20from bzrlib.tests import TestCaseWithTransport20from bzrlib.tests import TestCaseWithTransport
21from bzrlib.uncommit import uncommit21from bzrlib.uncommit import uncommit
22import pytz22import pytz
23from storm.locals import Store
23import transaction24import transaction
24from twisted.python.util import mergeFunctionMetadata25from twisted.python.util import mergeFunctionMetadata
25from zope.component import getUtility26from zope.component import getUtility
@@ -79,6 +80,8 @@
79 self.lp_db_user = config.launchpad.dbuser80 self.lp_db_user = config.launchpad.dbuser
80 self.makeFixtures()81 self.makeFixtures()
81 LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser)82 LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser)
83 # Catch both constraints and permissions for the db user.
84 self.addCleanup(Store.of(self.db_branch).flush)
8285
83 def tearDown(self):86 def tearDown(self):
84 super(BzrSyncTestCase, self).tearDown()87 super(BzrSyncTestCase, self).tearDown()