/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_transport_implementations.py

(robertc) Add MemoryTree and TreeBuilder test helpers. Also test behavior of transport.has('/') which caused failures in this when merging, and as a result cleanup the sftp path normalisation logic.

Show diffs side-by-side

added added

removed removed

Lines of Context:
92
92
        self.assertEqual(False, t.has_any(['c', 'c', 'c']))
93
93
        self.assertEqual(True, t.has_any(['b', 'b', 'b']))
94
94
 
 
95
    def test_has_root_works(self):
 
96
        current_transport = self.get_transport()
 
97
        # import pdb;pdb.set_trace()
 
98
        self.assertTrue(current_transport.has('/'))
 
99
        root = current_transport.clone('/')
 
100
        self.assertTrue(root.has(''))
 
101
 
95
102
    def test_get(self):
96
103
        t = self.get_transport()
97
104
 
1040
1047
        # Repeatedly go up to a parent directory until we're at the root
1041
1048
        # directory of this transport
1042
1049
        root_transport = orig_transport
1043
 
        while root_transport.clone("..").base != root_transport.base:
1044
 
            root_transport = root_transport.clone("..")
 
1050
        new_transport = root_transport.clone("..")
 
1051
        # as we are walking up directories, the path must be must be 
 
1052
        # growing less, except at the top
 
1053
        self.assertTrue(len(new_transport.base) < len(root_transport.base)
 
1054
            or new_transport.base == root_transport.base)
 
1055
        while new_transport.base != root_transport.base:
 
1056
            root_transport = new_transport
 
1057
            new_transport = root_transport.clone("..")
 
1058
            # as we are walking up directories, the path must be must be 
 
1059
            # growing less, except at the top
 
1060
            self.assertTrue(len(new_transport.base) < len(root_transport.base)
 
1061
                or new_transport.base == root_transport.base)
1045
1062
 
1046
1063
        # Cloning to "/" should take us to exactly the same location.
1047
1064
        self.assertEqual(root_transport.base, orig_transport.clone("/").base)
 
1065
        # the abspath of "/" from the original transport should be the same
 
1066
        # as the base at the root:
 
1067
        self.assertEqual(orig_transport.abspath("/"), root_transport.base)
1048
1068
 
1049
1069
        # At the root, the URL must still end with / as its a directory
1050
1070
        self.assertEqual(root_transport.base[-1], '/')