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

Fix ChrootTransportDecorator's clone to pass less surprising offsets to the decorated transport's clone.

Show diffs side-by-side

added added

removed removed

Lines of Context:
224
224
        self.assertRaises(InvalidURLJoin, urlutils.join,
225
225
                'http://foo', '../baz')
226
226
 
 
227
    def test_joinpath(self):
 
228
        def test(expected, *args):
 
229
            joined = urlutils.joinpath(*args)
 
230
            self.assertEqual(expected, joined)
 
231
 
 
232
        # Test a single element
 
233
        test('foo', 'foo')
 
234
 
 
235
        # Test relative path joining
 
236
        test('foo/bar', 'foo', 'bar')
 
237
        test('foo/bar', 'foo', '.', 'bar')
 
238
        test('foo/baz', 'foo', 'bar', '../baz')
 
239
        test('foo/bar/baz', 'foo', 'bar/baz')
 
240
        test('foo/baz', 'foo', 'bar/../baz')
 
241
 
 
242
        # Test joining to an absolute path
 
243
        test('/foo', '/foo')
 
244
        test('/foo', '/foo', '.')
 
245
        test('/foo/bar', '/foo', 'bar')
 
246
        test('/', '/foo', '..')
 
247
 
 
248
        # Test joining with an absolute path
 
249
        test('/bar', 'foo', '/bar')
 
250
        
 
251
        # Invalid joinings
 
252
        # Cannot go above root
 
253
        self.assertRaises(InvalidURLJoin, urlutils.joinpath, '/', '../baz')
 
254
 
227
255
    def test_function_type(self):
228
256
        if sys.platform == 'win32':
229
257
            self.assertEqual(urlutils._win32_local_path_to_url, urlutils.local_path_to_url)