~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/code/model/tests/test_branchpuller.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2009-07-09 09:55:54 UTC
  • mfrom: (8811.1.2 acquireBranchToPull-tweaks)
  • Revision ID: launchpad@pqm.canonical.com-20090709095554-d7885f4lep62mqdc
[r=rockstar][ui=none] small tweaks to acquireBranchToPull found when
        trying to use it in anger

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from lp.code.enums import BranchType
19
19
from lp.code.interfaces.branch import BranchTypeError
20
20
from lp.code.interfaces.branchpuller import IBranchPuller
21
 
from lp.testing import TestCaseWithFactory
 
21
from lp.testing import TestCaseWithFactory, login_person
22
22
 
23
23
 
24
24
class TestMirroringForHostedBranches(TestCaseWithFactory):
255
255
        branch.requestMirror()
256
256
        self.assertBranchIsAquired(branch)
257
257
 
 
258
    def test_private(self):
 
259
        # If there is a private branch that needs mirroring,
 
260
        # acquireBranchToPull returns that.
 
261
        branch = self.factory.makeAnyBranch(private=True)
 
262
        removeSecurityProxy(branch).requestMirror()
 
263
        self.assertBranchIsAquired(branch)
 
264
 
258
265
    def test_no_inprogress(self):
259
266
        # If a branch is being mirrored, it is not returned.
260
267
        branch = self.factory.makeAnyBranch()
292
299
    def assertBranchIsAquired(self, branch):
293
300
        """See `AcquireBranchToPullTests`."""
294
301
        acquired_branch = getUtility(IBranchPuller).acquireBranchToPull()
 
302
        login_person(removeSecurityProxy(branch).owner)
295
303
        self.assertEqual(branch, acquired_branch)
296
304
        self.assertIsNot(None, acquired_branch.last_mirror_attempt)
297
305
        self.assertIs(None, acquired_branch.next_mirror_time)