~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_bzrdir/test_bzrdir.py

  • Committer: Jelmer Vernooij
  • Date: 2010-04-30 11:35:43 UTC
  • mfrom: (5195 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5197.
  • Revision ID: jelmer@samba.org-20100430113543-tiqqhmqa3d8no4iu
merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
252
252
        bzrdir.create_branch()
253
253
        bzrdir.open_branch()
254
254
 
255
 
    def test_destroy_colocated_branch(self):
256
 
        branch = self.make_branch('branch')
257
 
        bzrdir = branch.bzrdir
258
 
        try:
259
 
            colo_branch = bzrdir.create_branch('colo')
260
 
        except errors.NoColocatedBranchSupport:
261
 
            raise TestNotApplicable('BzrDir does not do colocated branches')
262
 
        bzrdir.destroy_branch("colo")
263
 
        self.assertRaises(errors.NotBranchError, bzrdir.open_branch, 
264
 
                          "colo")
265
 
 
266
255
    def test_destroy_repository(self):
267
256
        repo = self.make_repository('repository')
268
257
        bzrdir = repo.bzrdir
1421
1410
        self.failUnless(isinstance(made_branch, bzrlib.branch.Branch))
1422
1411
        self.assertEqual(made_control, made_branch.bzrdir)
1423
1412
 
1424
 
    def test_create_colo_branch(self):
1425
 
        # a bzrdir can construct a branch and repository for itself.
1426
 
        if not self.bzrdir_format.is_supported():
1427
 
            # unsupported formats are not loopback testable
1428
 
            # because the default open will not open them and
1429
 
            # they may not be initializable.
1430
 
            raise TestNotApplicable('Control dir format not supported')
1431
 
        t = get_transport(self.get_url())
1432
 
        made_control = self.bzrdir_format.initialize(t.base)
1433
 
        made_repo = made_control.create_repository()
1434
 
        try:
1435
 
            made_branch = made_control.create_branch("colo")
1436
 
        except errors.NoColocatedBranchSupport:
1437
 
            raise TestNotApplicable('Colocated branches not supported')
1438
 
        self.failUnless(isinstance(made_branch, bzrlib.branch.Branch))
1439
 
        self.assertEqual(made_control, made_branch.bzrdir)
1440
 
 
1441
1413
    def test_open_branch(self):
1442
1414
        if not self.bzrdir_format.is_supported():
1443
1415
            # unsupported formats are not loopback testable
1999
1971
        self.assertRaises(errors.NoRepositoryPresent,
2000
1972
                          made_control.find_repository)
2001
1973
 
 
1974
 
 
1975
class TestBzrDirControlComponent(TestCaseWithBzrDir):
 
1976
    """BzrDir implementations adequately implement ControlComponent."""
 
1977
    
 
1978
    def test_urls(self):
 
1979
        bd = self.make_bzrdir('bd')
 
1980
        self.assertIsInstance(bd.user_url, str)
 
1981
        self.assertEqual(bd.user_url, bd.user_transport.base)
 
1982
        # for all current bzrdir implementations the user dir must be 
 
1983
        # above the control dir but we might need to relax that?
 
1984
        self.assertEqual(bd.control_url.find(bd.user_url), 0)
 
1985
        self.assertEqual(bd.control_url, bd.control_transport.base)