~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_urlutils.py

  • Committer: John Arbash Meinel
  • Date: 2006-07-13 18:38:58 UTC
  • mfrom: (1863 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1869.
  • Revision ID: john@arbash-meinel.com-20060713183858-ebf4aa1f9ef8bb6e
[merge] bzr.dev 1863

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for the urlutils wrapper."""
18
18
 
19
19
import os
 
20
import re
20
21
import sys
21
22
 
 
23
from bzrlib import osutils, urlutils
22
24
import bzrlib
23
25
from bzrlib.errors import InvalidURL, InvalidURLJoin
24
 
import bzrlib.urlutils as urlutils
25
26
from bzrlib.tests import TestCaseInTempDir, TestCase, TestSkipped
26
27
 
27
28
 
464
465
        test('http://host/', 'http://host', 'http://host/')
465
466
        #test('.', 'http://host/', 'http://host')
466
467
        test('http://host', 'http://host/', 'http://host')
 
468
 
 
469
 
 
470
class TestCwdToURL(TestCaseInTempDir):
 
471
    """Test that local_path_to_url works base on the cwd"""
 
472
 
 
473
    def test_dot(self):
 
474
        # This test will fail if getcwd is not ascii
 
475
        os.mkdir('mytest')
 
476
        os.chdir('mytest')
 
477
 
 
478
        url = urlutils.local_path_to_url('.')
 
479
        self.assertEndsWith(url, '/mytest')
 
480
 
 
481
    def test_non_ascii(self):
 
482
        try:
 
483
            os.mkdir(u'dod\xe9')
 
484
        except UnicodeError:
 
485
            raise TestSkipped('cannot create unicode directory')
 
486
 
 
487
        os.chdir(u'dod\xe9')
 
488
 
 
489
        # On Mac OSX this directory is actually: 
 
490
        #   u'/dode\u0301' => '/dode\xcc\x81
 
491
        # but we should normalize it back to 
 
492
        #   u'/dod\xe9' => '/dod\xc3\xa9'
 
493
        url = urlutils.local_path_to_url('.')
 
494
        self.assertEndsWith(url, '/dod%C3%A9')