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'))
287
287
except UnicodeError:
288
288
raise TestSkipped("local encoding cannot handle unicode")
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)
293
293
def test_win32_local_path_from_url(self):
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')
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'))
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:///'))