/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

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
209
209
        test('http://bar', 'http://foo', 'http://bar')
210
210
        test('sftp://bzr/foo', 'http://foo', 'bar', 'sftp://bzr/foo')
211
211
        test('file:///bar', 'foo', 'file:///bar')
 
212
 
 
213
        # From a base path
 
214
        test('file:///foo', 'file:///', 'foo')
 
215
        test('file:///bar/foo', 'file:///bar/', 'foo')
 
216
        test('http://host/foo', 'http://host/', 'foo')
 
217
        test('http://host/', 'http://host', '')
212
218
        
213
219
        # Invalid joinings
214
220
        # Cannot go above root
271
277
        # Not a valid _win32 url, no drive letter
272
278
        self.assertRaises(InvalidURL, from_url, 'file:///path/to/foo')
273
279
 
 
280
    def test__win32_extract_drive_letter(self):
 
281
        extract = urlutils._win32_extract_drive_letter
 
282
        self.assertEqual(('file:///C:', '/foo'), extract('file://', '/C:/foo'))
 
283
        self.assertEqual(('file:///d|', '/path'), extract('file://', '/d|/path'))
 
284
        self.assertRaises(InvalidURL, extract, 'file://', '/path')
 
285
 
274
286
    def test_split(self):
275
287
        # Test bzrlib.urlutils.split()
276
288
        split = urlutils.split
306
318
        self.assertEqual(('path/..', 'foo'), split('path/../foo'))
307
319
        self.assertEqual(('../path', 'foo'), split('../path/foo'))
308
320
 
 
321
    def test__win32_strip_local_trailing_slash(self):
 
322
        strip = urlutils._win32_strip_local_trailing_slash
 
323
        self.assertEqual('file://', strip('file://'))
 
324
        self.assertEqual('file:///', strip('file:///'))
 
325
        self.assertEqual('file:///C', strip('file:///C'))
 
326
        self.assertEqual('file:///C:', strip('file:///C:'))
 
327
        self.assertEqual('file:///d|', strip('file:///d|'))
 
328
        self.assertEqual('file:///C:/', strip('file:///C:/'))
 
329
        self.assertEqual('file:///C:/a', strip('file:///C:/a/'))
 
330
 
309
331
    def test_strip_trailing_slash(self):
310
332
        sts = urlutils.strip_trailing_slash
311
333
        if sys.platform == 'win32':