1743
1744
t.get_smart_medium().send_http_smart_request,
1747
class Test_redirected_to(tests.TestCase):
1749
def test_redirected_to_subdir(self):
1750
t = self._transport('http://www.example.com/foo')
1751
r = t._redirected_to('http://www.example.com/foo',
1752
'http://www.example.com/foo/subdir')
1753
self.assertIsInstance(r, type(t))
1754
# Both transports share the some connection
1755
self.assertEquals(t._get_connection(), r._get_connection())
1757
def test_redirected_to_self_with_slash(self):
1758
t = self._transport('http://www.example.com/foo')
1759
r = t._redirected_to('http://www.example.com/foo',
1760
'http://www.example.com/foo/')
1761
self.assertIsInstance(r, type(t))
1762
# Both transports share the some connection (one can argue that we
1763
# should return the exact same transport here, but that seems
1765
self.assertEquals(t._get_connection(), r._get_connection())
1767
def test_redirected_to_host(self):
1768
t = self._transport('http://www.example.com/foo')
1769
r = t._redirected_to('http://www.example.com/foo',
1770
'http://foo.example.com/foo/subdir')
1771
self.assertIsInstance(r, type(t))
1773
def test_redirected_to_same_host_sibling_protocol(self):
1774
t = self._transport('http://www.example.com/foo')
1775
r = t._redirected_to('http://www.example.com/foo',
1776
'https://www.example.com/foo')
1777
self.assertIsInstance(r, type(t))
1779
def test_redirected_to_same_host_different_protocol(self):
1780
t = self._transport('http://www.example.com/foo')
1781
r = t._redirected_to('http://www.example.com/foo',
1782
'ftp://www.example.com/foo')
1783
self.assertNotEquals(type(r), type(t))
1785
def test_redirected_to_different_host_same_user(self):
1786
t = self._transport('http://joe@www.example.com/foo')
1787
r = t._redirected_to('http://www.example.com/foo',
1788
'https://foo.example.com/foo')
1789
self.assertIsInstance(r, type(t))
1790
self.assertEquals(t._user, r._user)