~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_urlutils.py

  • Committer: Alexander Belchenko
  • Date: 2006-12-07 16:16:23 UTC
  • mto: This revision was merged to the branch mainline in revision 2172.
  • Revision ID: bialix@ukr.net-20061207161623-2yw05sjrahm00bb8
Change tests for win32 UNC path to new file://HOST/path scheme

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
 
278
278
    def test_win32_unc_path_to_url(self):
279
279
        to_url = urlutils._win32_local_path_to_url
280
 
        self.assertEqual('file://///HOST/path',
 
280
        self.assertEqual('file://HOST/path',
281
281
            to_url(r'\\HOST\path'))
282
 
        self.assertEqual('file://///HOST/path',
 
282
        self.assertEqual('file://HOST/path',
283
283
            to_url('//HOST/path'))
284
284
 
285
285
        try:
287
287
        except UnicodeError:
288
288
            raise TestSkipped("local encoding cannot handle unicode")
289
289
 
290
 
        self.assertEqual('file://///HOST/path/to/r%C3%A4ksm%C3%B6rg%C3%A5s', result)
 
290
        self.assertEqual('file://HOST/path/to/r%C3%A4ksm%C3%B6rg%C3%A5s', result)
291
291
 
292
292
 
293
293
    def test_win32_local_path_from_url(self):
305
305
 
306
306
    def test_win32_unc_path_from_url(self):
307
307
        from_url = urlutils._win32_local_path_from_url
308
 
        self.assertEqual('//HOST/path', from_url('file://///HOST/path'))
309
 
        # despite IE allows 4, 5 and 6 slashes in URL to another machine
310
 
        # Firefox don't understand this
 
308
        self.assertEqual('//HOST/path', from_url('file://HOST/path'))
 
309
        # despite IE allows 2, 4, 5 and 6 slashes in URL to another machine
 
310
        # we want to use only 2 slashes
 
311
        # Firefox understand only 5 slashes in URL, but it's ugly
311
312
        self.assertRaises(InvalidURL, from_url, 'file:////HOST/path')
 
313
        self.assertRaises(InvalidURL, from_url, 'file://///HOST/path')
312
314
        self.assertRaises(InvalidURL, from_url, 'file://////HOST/path')
 
315
        # check for file://C:/ instead of file:///C:/
 
316
        self.assertRaises(InvalidURL, from_url, 'file://C:/path')
313
317
 
314
 
    def test__win32_extract_drive_letter(self):
 
318
    def test_win32_extract_drive_letter(self):
315
319
        extract = urlutils._win32_extract_drive_letter
316
320
        self.assertEqual(('file:///C:', '/foo'), extract('file://', '/C:/foo'))
317
321
        self.assertEqual(('file:///d|', '/path'), extract('file://', '/d|/path'))
352
356
        self.assertEqual(('path/..', 'foo'), split('path/../foo'))
353
357
        self.assertEqual(('../path', 'foo'), split('../path/foo'))
354
358
 
355
 
    def test__win32_strip_local_trailing_slash(self):
 
359
    def test_win32_strip_local_trailing_slash(self):
356
360
        strip = urlutils._win32_strip_local_trailing_slash
357
361
        self.assertEqual('file://', strip('file://'))
358
362
        self.assertEqual('file:///', strip('file:///'))