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
1=== modified file 'database/schema/security.cfg'
2--- database/schema/security.cfg 2010-09-03 16:43:11 +0000
3+++ database/schema/security.cfg 2010-09-10 02:48:47 +0000
4@@ -593,6 +593,7 @@
5 public.diff = SELECT, INSERT, DELETE
6 public.distroseries = SELECT
7 public.distribution = SELECT
8+public.distributionsourcepackage = SELECT, UPDATE
9 public.emailaddress = SELECT
10 public.job = SELECT, INSERT, UPDATE, DELETE
11 # Karma
12
13=== modified file 'lib/lp/codehosting/scanner/tests/test_buglinks.py'
14--- lib/lp/codehosting/scanner/tests/test_buglinks.py 2010-08-20 20:31:18 +0000
15+++ lib/lp/codehosting/scanner/tests/test_buglinks.py 2010-09-10 02:48:47 +0000
16@@ -12,6 +12,7 @@
17 from bzrlib.revision import Revision
18 from zope.component import getUtility
19 from zope.event import notify
20+from zope.security.proxy import removeSecurityProxy
21
22 from canonical.config import config
23 from canonical.launchpad.interfaces import (
24@@ -120,8 +121,16 @@
25 def makeFixtures(self):
26 super(TestBugLinking, self).makeFixtures()
27 self.bug1 = self.factory.makeBug()
28+ sp = self.factory.makeSourcePackage()
29+ self.bug1.addTask(self.bug1.owner, sp)
30+ dsp = self.factory.makeDistributionSourcePackage()
31+ self.bug1.addTask(self.bug1.owner, dsp)
32+ distro = self.factory.makeDistribution()
33+ self.bug1.addTask(self.bug1.owner, distro)
34 self.bug2 = self.factory.makeBug()
35 self.new_db_branch = self.factory.makeAnyBranch()
36+ removeSecurityProxy(distro).max_bug_heat = 0;
37+ removeSecurityProxy(dsp).max_bug_heat = 0;
38 self.layer.txn.commit()
39
40 def getBugURL(self, bug):
41
42=== modified file 'lib/lp/codehosting/scanner/tests/test_bzrsync.py'
43--- lib/lp/codehosting/scanner/tests/test_bzrsync.py 2010-08-20 20:31:18 +0000
44+++ lib/lp/codehosting/scanner/tests/test_bzrsync.py 2010-09-10 02:48:47 +0000
45@@ -20,6 +20,7 @@
46 from bzrlib.tests import TestCaseWithTransport
47 from bzrlib.uncommit import uncommit
48 import pytz
49+from storm.locals import Store
50 import transaction
51 from twisted.python.util import mergeFunctionMetadata
52 from zope.component import getUtility
53@@ -79,6 +80,8 @@
54 self.lp_db_user = config.launchpad.dbuser
55 self.makeFixtures()
56 LaunchpadZopelessLayer.switchDbUser(config.branchscanner.dbuser)
57+ # Catch both constraints and permissions for the db user.
58+ self.addCleanup(Store.of(self.db_branch).flush)
59
60 def tearDown(self):
61 super(BzrSyncTestCase, self).tearDown()