~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.py

  • Committer: Jelmer Vernooij
  • Date: 2011-08-08 17:52:59 UTC
  • mto: (5268.7.8 transport-segments)
  • mto: This revision was merged to the branch mainline in revision 6062.
  • Revision ID: jelmer@samba.org-20110808175259-putdqc0lnztp367v
Add UnparsedUrl.

Show diffs side-by-side

added added

removed removed

Lines of Context:
780
780
    def test_parse_url(self):
781
781
        t = transport.ConnectedTransport(
782
782
            'http://simple.example.com/home/source')
783
 
        self.assertEquals(t._host, 'simple.example.com')
784
 
        self.assertEquals(t._port, None)
785
 
        self.assertEquals(t._path, '/home/source/')
786
 
        self.assertTrue(t._user is None)
787
 
        self.assertTrue(t._password is None)
 
783
        self.assertEquals(t._parsed_url.host, 'simple.example.com')
 
784
        self.assertEquals(t._parsed_url.port, None)
 
785
        self.assertEquals(t._parsed_url.path, '/home/source/')
 
786
        self.assertTrue(t._parsed_url.user is None)
 
787
        self.assertTrue(t._parsed_url.password is None)
788
788
 
789
789
        self.assertEquals(t.base, 'http://simple.example.com/home/source/')
790
790
 
791
791
    def test_parse_url_with_at_in_user(self):
792
792
        # Bug 228058
793
793
        t = transport.ConnectedTransport('ftp://user@host.com@www.host.com/')
794
 
        self.assertEquals(t._user, 'user@host.com')
 
794
        self.assertEquals(t._parsed_url.user, 'user@host.com')
795
795
 
796
796
    def test_parse_quoted_url(self):
797
797
        t = transport.ConnectedTransport(
798
798
            'http://ro%62ey:h%40t@ex%41mple.com:2222/path')
799
 
        self.assertEquals(t._host, 'exAmple.com')
800
 
        self.assertEquals(t._port, 2222)
801
 
        self.assertEquals(t._user, 'robey')
802
 
        self.assertEquals(t._password, 'h@t')
803
 
        self.assertEquals(t._path, '/path/')
 
799
        self.assertEquals(t._parsed_url.host, 'exAmple.com')
 
800
        self.assertEquals(t._parsed_url.port, 2222)
 
801
        self.assertEquals(t._parsed_url.user, 'robey')
 
802
        self.assertEquals(t._parsed_url.password, 'h@t')
 
803
        self.assertEquals(t._parsed_url.path, '/path/')
804
804
 
805
805
        # Base should not keep track of the password
806
806
        self.assertEquals(t.base, 'http://robey@exAmple.com:2222/path/')
833
833
 
834
834
    def test_connection_sharing_propagate_credentials(self):
835
835
        t = transport.ConnectedTransport('ftp://user@host.com/abs/path')
836
 
        self.assertEquals('user', t._user)
837
 
        self.assertEquals('host.com', t._host)
 
836
        self.assertEquals('user', t._parsed_url.user)
 
837
        self.assertEquals('host.com', t._parsed_url.host)
838
838
        self.assertIs(None, t._get_connection())
839
 
        self.assertIs(None, t._password)
 
839
        self.assertIs(None, t._parsed_url.password)
840
840
        c = t.clone('subdir')
841
841
        self.assertIs(None, c._get_connection())
842
 
        self.assertIs(None, t._password)
 
842
        self.assertIs(None, t._parsed_url.password)
843
843
 
844
844
        # Simulate the user entering a password
845
845
        password = 'secret'