~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/branch_implementations/test_parent.py

Upgraded to the latest bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
 
import cStringIO
19
 
import os
20
18
import sys
21
19
 
22
 
from bzrlib.branch import Branch
23
20
import bzrlib.errors
24
 
from bzrlib.osutils import abspath, realpath, getcwd
25
 
from bzrlib.urlutils import local_path_from_url, local_path_to_url, escape
 
21
from bzrlib.osutils import getcwd
26
22
from bzrlib.tests import TestCaseWithTransport
 
23
from bzrlib import urlutils
27
24
 
28
25
 
29
26
"""Tests for Branch parent URL"""
38
35
        
39
36
    def test_set_get_parent(self):
40
37
        """Set, re-get and reset the parent"""
41
 
        b = self.make_branch('.')
 
38
        b = self.make_branch('subdir')
42
39
        url = 'http://bazaar-vcs.org/bzr/bzr.dev'
43
40
        b.set_parent(url)
44
41
        self.assertEqual(url, b.get_parent())
49
46
 
50
47
        b.set_parent('../other_branch')
51
48
 
52
 
        self.assertEqual(local_path_to_url('../other_branch'), b.get_parent())
53
 
        path = local_path_to_url('../yanb')
 
49
        expected_parent = urlutils.join(self.get_url('subdir'),
 
50
                                        '../other_branch')
 
51
        self.assertEqual(expected_parent, b.get_parent())
 
52
        path = urlutils.join(self.get_url('subdir'), '../yanb')
54
53
        b.set_parent(path)
55
54
        self.assertEqual('../yanb', b._get_parent_location())
56
55
        self.assertEqual(path, b.get_parent())
57
56
 
58
57
 
59
58
        self.assertRaises(bzrlib.errors.InvalidURL, b.set_parent, u'\xb5')
60
 
        b.set_parent(escape(u'\xb5'))
 
59
        b.set_parent(urlutils.escape(u'\xb5'))
61
60
        self.assertEqual('%C2%B5', b._get_parent_location())
62
61
 
63
62
        self.assertEqual(b.base + '%C2%B5', b.get_parent())