20
20
and attributes colocated branch support added should fail in known ways.
23
from bzrlib import errors
24
27
from bzrlib.tests import (
27
from bzrlib.transport import (
31
from bzrlib.tests.per_controldir_colo import (
32
TestCaseWithControlDir,
36
class TestNoColocatedSupport(TestCaseWithControlDir):
32
class TestNoColocatedSupport(per_controldir.TestCaseWithControlDir):
38
34
def make_bzrdir_with_repo(self):
39
35
# a bzrdir can construct a branch and repository for itself.
41
37
# unsupported formats are not loopback testable
42
38
# because the default open will not open them and
43
39
# they may not be initializable.
44
raise TestNotApplicable('Control dir format not supported')
45
t = get_transport(self.get_url())
46
made_control = self.bzrdir_format.initialize(t.base)
40
raise tests.TestNotApplicable('Control dir format not supported')
41
t = self.get_transport()
43
made_control = self.make_bzrdir('.', format=self.bzrdir_format)
44
except errors.UninitializableFormat:
45
raise tests.TestNotApplicable('Control dir format not initializable')
46
self.assertEquals(made_control._format, self.bzrdir_format)
47
47
made_repo = made_control.create_repository()
48
48
return made_control
60
60
self.assertRaises(errors.NoColocatedBranchSupport,
61
61
made_control.create_branch, "colo")
63
def test_branch_transport(self):
63
def test_open_branch(self):
64
64
made_control = self.make_bzrdir_with_repo()
65
65
self.assertRaises(errors.NoColocatedBranchSupport,
66
made_control.get_branch_transport, None, "colo")
66
made_control.open_branch, name="colo")
68
68
def test_get_branch_reference(self):
69
69
made_control = self.make_bzrdir_with_repo()
70
70
self.assertRaises(errors.NoColocatedBranchSupport,
71
71
made_control.get_branch_reference, "colo")
73
def test_set_branch_reference(self):
74
referenced = self.make_branch('referenced')
75
made_control = self.make_bzrdir_with_repo()
76
self.assertRaises(errors.NoColocatedBranchSupport,
77
made_control.set_branch_reference, referenced, name="colo")
79
def test_get_branches(self):
80
made_control = self.make_bzrdir_with_repo()
81
made_control.create_branch()
82
self.assertEqual(made_control.get_branches().keys(),