815
816
TestCaseWithWebserver):
816
817
"""Test the Range header in GET methods for pycurl implementation"""
820
class TestRedirections(object):
821
"""Test redirection from the 'old' server to the 'new' server.
823
This MUST be used by daughter classes that also inherit from
824
TestCaseWithTwoWebservers.
826
We can't inherit directly from TestCaseWithTwoWebservers or the
827
test framework will try to create an instance which cannot
828
run, its implementation being incomplete.
831
def create_transport_secondary_server(self):
832
"""Create the secondary server redirecting to the primary server"""
833
new = self.get_new_server()
835
return HTTPServerRedirecting(new.host, new.port)
837
def get_old_server(self):
838
"""The redirected server"""
839
return self.get_secondary_server()
841
def get_new_server(self):
842
"""The redirected to server"""
843
return self.get_readonly_server()
846
super(TestRedirections, self).setUp()
847
new = self.get_new_server()
848
old = self.get_old_server()
850
self.build_tree_contents([('a', '0123456789')],)
852
self.new_transport = self._transport(new.get_url())
853
self.old_transport = self._transport(old.get_url())
855
def test_redirected(self):
856
old = self.old_transport
857
hints = old.create_get_hints(follow_redirections=False)
858
self.assertRaises(errors.RedirectRequested, old.get, 'a', **hints)
860
def test_redirection_loop(self):
864
class TestRedirections_urllib(TestRedirections,
865
TestCaseWithTwoWebservers):
866
"""Tests redirections for urllib implementation"""
868
_transport = HttpTransport_urllib