/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_branch.py

  • Committer: Aaron Bentley
  • Date: 2007-01-12 21:39:24 UTC
  • mto: (2230.3.47 branch6)
  • mto: This revision was merged to the branch mainline in revision 2290.
  • Revision ID: abentley@panoramicfeedback.com-20070112213924-t9fm7x7foi5uqa83
Add more config testing

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
from StringIO import StringIO
26
26
 
27
 
from bzrlib import branch as _mod_branch
 
27
from bzrlib import (
 
28
    branch as _mod_branch,
 
29
    urlutils,
 
30
    )
28
31
import bzrlib.branch
29
32
from bzrlib.branch import (BzrBranch5, 
30
33
                           BzrBranchFormat5)
77
80
        finally:
78
81
            branch.unlock()
79
82
 
 
83
    def test_set_push_location(self):
 
84
        from bzrlib.config import (locations_config_filename,
 
85
                                   ensure_config_dir_exists)
 
86
        ensure_config_dir_exists()
 
87
        fn = locations_config_filename()
 
88
        branch = self.make_branch('.', format='knit')
 
89
        branch.set_push_location('foo')
 
90
        local_path = urlutils.local_path_from_url(branch.base[:-1])
 
91
        self.assertFileEqual("[%s]\n"
 
92
                             "push_location = foo\n"
 
93
                             "push_location:policy = norecurse" % local_path,
 
94
                             fn)
 
95
 
 
96
    # TODO RBC 20051029 test getting a push location from a branch in a 
 
97
    # recursive section - that is, it appends the branch name.
 
98
 
80
99
 
81
100
class SampleBranchFormat(bzrlib.branch.BranchFormat):
82
101
    """A sample format
164
183
        self.failUnlessExists('a/.bzr/branch/last-revision')
165
184
        self.failIfExists('a/.bzr/branch/revision-history')
166
185
 
 
186
    def test_config(self):
 
187
        """Ensure that all configuration data is stored in the branch"""
 
188
        branch = self.make_branch('a', format='experimental-branch6')
 
189
        branch.set_parent('http://bazaar-vcs.org')
 
190
        self.failIfExists('a/.bzr/branch/parent')
 
191
        self.assertEqual('http://bazaar-vcs.org', branch.get_parent())
 
192
        branch.set_push_location('sftp://bazaar-vcs.org')
 
193
        config = branch.get_config()._get_branch_data_config()
 
194
        self.assertEqual('sftp://bazaar-vcs.org', 
 
195
                         config.get_user_option('push_location'))
 
196
        branch.set_bound_location('ftp://bazaar-vcs.org')
 
197
        self.failIfExists('a/.bzr/branch/bound')
 
198
        self.assertEqual('ftp://bazaar-vcs.org', branch.get_bound_location())
 
199
 
167
200
 
168
201
class TestBranchReference(TestCaseWithTransport):
169
202
    """Tests for the branch reference facility."""