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)
789
789
self.assertEquals(t.base, 'http://simple.example.com/home/source/')
791
791
def test_parse_url_with_at_in_user(self):
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')
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/')
805
805
# Base should not keep track of the password
806
806
self.assertEquals(t.base, 'http://robey@exAmple.com:2222/path/')
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)
844
844
# Simulate the user entering a password
845
845
password = 'secret'