launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #11330
[Merge] lp:~stevenk/launchpad/branch-scanner-private-bugs into lp:launchpad
Steve Kowalik has proposed merging lp:~stevenk/launchpad/branch-scanner-private-bugs into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1040777 in Launchpad itself: "Scanning of branches with linked private bugs is broken"
https://bugs.launchpad.net/launchpad/+bug/1040777
For more details, see:
https://code.launchpad.net/~stevenk/launchpad/branch-scanner-private-bugs/+merge/121376
Write a test that catches the error pointed out in the bug and linked OOPS. I have verified that the test fails without the DB perm, and passes with it.
--
https://code.launchpad.net/~stevenk/launchpad/branch-scanner-private-bugs/+merge/121376
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~stevenk/launchpad/branch-scanner-private-bugs into lp:launchpad.
=== modified file 'lib/lp/code/model/tests/test_branchjob.py'
--- lib/lp/code/model/tests/test_branchjob.py 2012-06-28 01:14:33 +0000
+++ lib/lp/code/model/tests/test_branchjob.py 2012-08-27 07:57:21 +0000
@@ -65,6 +65,8 @@
from lp.code.model.revision import RevisionSet
from lp.code.model.tests.test_branch import create_knit
from lp.codehosting.vfs import branch_id_to_path
+from lp.registry.enums import InformationType
+from lp.registry.interfaces.accesspolicy import IAccessPolicySource
from lp.scripts.helpers import TransactionFreeOperation
from lp.services.config import config
from lp.services.database.constants import UTC_NOW
@@ -173,6 +175,22 @@
self.assertEqual(db_branch.revision_count, 5)
+ def test_run_with_private_linked_bug(self):
+ """Ensure the job scans the private branch with a private bug."""
+ self.useBzrBranches(direct_database=True)
+ db_branch, bzr_tree = self.create_branch_and_tree()
+ product = self.factory.makeProduct()
+ private_bug = self.factory.makeBug(
+ target=product, information_type=InformationType.USERDATA)
+ bug_line = 'https://launchpad.net/bugs/%s fixed' % private_bug.id
+ with override_environ(BZR_EMAIL='me@xxxxxxxxxxx'):
+ bzr_tree.commit(
+ 'First commit', rev_id='rev1', revprops={'bugs': bug_line})
+ job = BranchScanJob.create(db_branch)
+ with dbuser(config.branchscanner.dbuser):
+ job.run()
+ self.assertEqual(db_branch.revision_count, 1)
+
class TestBranchUpgradeJob(TestCaseWithFactory):
"""Tests for `BranchUpgradeJob`."""
Follow ups