~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-05 08:25:42 UTC
  • mto: This revision was merged to the branch mainline in revision 2172.
  • Revision ID: bialix@ukr.net-20061205082542-75u09rv7dee41mhh
Testing UNC path conversion

Show diffs side-by-side

added added

removed removed

Lines of Context:
275
275
 
276
276
        self.assertEqual('file:///D:/path/to/r%C3%A4ksm%C3%B6rg%C3%A5s', result)
277
277
 
 
278
    def test_win32_unc_path_to_url(self):
 
279
        to_url = urlutils._win32_local_path_to_url
 
280
        self.assertEqual('file://///HOST/path',
 
281
            to_url(r'\\HOST\path'))
 
282
        self.assertEqual('file://///HOST/path',
 
283
            to_url('//HOST/path'))
 
284
 
278
285
    def test_win32_local_path_from_url(self):
279
286
        from_url = urlutils._win32_local_path_from_url
280
287
        self.assertEqual('C:/path/to/foo',
288
295
        # Not a valid _win32 url, no drive letter
289
296
        self.assertRaises(InvalidURL, from_url, 'file:///path/to/foo')
290
297
 
 
298
    def test_win32_unc_path_from_url(self):
 
299
        from_url = urlutils._win32_local_path_from_url
 
300
        self.assertEqual('//HOST/path', from_url('file://///HOST/path'))
 
301
        # despite IE allows 4, 5 and 6 slashes in URL to another machine
 
302
        # Firefox don't understand this
 
303
        self.assertRaises(InvalidURL, from_url, 'file:////HOST/path')
 
304
        self.assertRaises(InvalidURL, from_url, 'file://////HOST/path')
 
305
 
291
306
    def test__win32_extract_drive_letter(self):
292
307
        extract = urlutils._win32_extract_drive_letter
293
308
        self.assertEqual(('file:///C:', '/foo'), extract('file://', '/C:/foo'))