~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

Got the bzrdir api straightened out, plenty of refactoring to use it pending, but the api is up and running.

Show diffs side-by-side

added added

removed removed

Lines of Context:
116
116
        # which branch.Open will refuse (not supported)
117
117
        self.assertRaises(UnsupportedFormatError, branch.Branch.open, self.get_url())
118
118
        # but open_downlevel will work
119
 
        self.assertEqual(format.open(dir), branch.Branch.open_downlevel(self.get_url()))
 
119
        self.assertEqual(format.open(dir), bzrdir.BzrDir.open(self.get_url()).open_branch(unsupported=True))
120
120
        # unregister the format
121
121
        branch.BranchFormat.unregister_format(format)
 
122
 
 
123
 
 
124
class TestBranchReference(TestCaseWithTransport):
 
125
    """Tests for the branch reference facility."""
 
126
 
 
127
    def test_create_open_reference(self):
 
128
        bzrdirformat = bzrdir.BzrDirMetaFormat1()
 
129
        t = get_transport(self.get_url('.'))
 
130
        t.mkdir('repo')
 
131
        dir = bzrdirformat.initialize(self.get_url('repo'))
 
132
        dir.create_repository()
 
133
        target_branch = dir.create_branch()
 
134
        t.mkdir('branch')
 
135
        branch_dir = bzrdirformat.initialize(self.get_url('branch'))
 
136
        made_branch = branch.BranchReferenceFormat().initialize(branch_dir, target_branch)
 
137
        self.assertEqual(made_branch.base, target_branch.base)
 
138
        opened_branch = branch_dir.open_branch()
 
139
        self.assertEqual(opened_branch.base, target_branch.base)