~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2007-03-28 07:08:42 UTC
  • mfrom: (2380 +trunk)
  • mto: (2018.5.146 hpss)
  • mto: This revision was merged to the branch mainline in revision 2414.
  • Revision ID: andrew.bennetts@canonical.com-20070328070842-r843houy668oxb9o
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
        url = 'http://bazaar-vcs.org/bzr/bzr.dev'
43
43
        b.set_parent(url)
44
44
        self.assertEqual(url, b.get_parent())
45
 
        self.assertEqual(url, b.control_files.get('parent').read().strip('\n'))
 
45
        self.assertEqual(url, b._get_parent_location())
46
46
 
47
47
        b.set_parent(None)
48
48
        self.assertEqual(None, b.get_parent())
52
52
        self.assertEqual(local_path_to_url('../other_branch'), b.get_parent())
53
53
        path = local_path_to_url('../yanb')
54
54
        b.set_parent(path)
55
 
        self.assertEqual('../yanb',
56
 
            b.control_files.get('parent').read().strip('\n'))
 
55
        self.assertEqual('../yanb', b._get_parent_location())
57
56
        self.assertEqual(path, b.get_parent())
58
57
 
59
58
 
60
59
        self.assertRaises(bzrlib.errors.InvalidURL, b.set_parent, u'\xb5')
61
60
        b.set_parent(escape(u'\xb5'))
62
 
        self.assertEqual('%C2%B5',
63
 
            b.control_files.get('parent').read().strip('\n'))
 
61
        self.assertEqual('%C2%B5', b._get_parent_location())
64
62
 
65
63
        self.assertEqual(b.base + '%C2%B5', b.get_parent())
66
64
 
70
68
            #       paths as well? Nobody has complained about it.
71
69
            pass
72
70
        else:
73
 
            b.control_files.put('parent', cStringIO.StringIO('/local/abs/path'))
 
71
            b._set_parent_location('/local/abs/path')
74
72
            self.assertEqual('file:///local/abs/path', b.get_parent())
75
73
 
76
74
    def test_get_invalid_parent(self):
82
80
        # Force the relative path to be something invalid
83
81
        # This should attempt to go outside the filesystem
84
82
        path = ('../'*(n_dirs+5)) + 'foo'
85
 
        b.control_files.put('parent', cStringIO.StringIO(path))
 
83
        b._set_parent_location(path)
86
84
 
87
85
        # With an invalid branch parent, just return None
88
86
        self.assertRaises(bzrlib.errors.InaccessibleParent, b.get_parent)