def test_redirect_sticky_with_proxy(self):
     location = "http://example.org/"
     hm = HTTPMonitor("10.20.30.40", "tester.test", "http://tester.test:8888/path", 3128)
     hm._follow = "sticky"
     hm._proxyIp = "10.10.10.10"
     hm._hostnameIp.append("10.20.30.50")
     hm.makeURL()
     agent = RedirectAgentZ(Agent, onRedirect=hm._follow, port=hm._port, proxy=hm._proxyIp)
     self.assertEqual(agent._resolveLocation(hm._reqURL, location), "http://tester.test/")
 def test_redirect_stickyport_443(self):
     location = "http://example.org/"
     hm = HTTPMonitor("10.20.30.40", "tester.test", "/path", 443)
     hm._follow = "stickyport"
     hm._proxyIp = ""
     hm._hostnameIp.append("10.20.30.40")
     hm.makeURL()
     agent = RedirectAgentZ(Agent, onRedirect=hm._follow, port=hm._port, proxy=hm._proxyIp)
     self.assertEqual(agent._resolveLocation(hm._reqURL, location), "http://example.org:443/")
 def test_redirect_stickyport_443(self):
     location = "http://example.org/"
     hm = HTTPMonitor("10.20.30.40", "tester.test", "/path", 443)
     hm._follow = "stickyport"
     hm._proxyIp = ""
     hm._hostnameIp.append("10.20.30.40")
     hm.makeURL()
     agent = RedirectAgentZ(Agent,
                            onRedirect=hm._follow,
                            port=hm._port,
                            proxy=hm._proxyIp)
     self.assertEqual(agent._resolveLocation(hm._reqURL, location),
                      "http://example.org:443/")
 def test_redirect_sticky_with_proxy(self):
     location = "http://example.org/"
     hm = HTTPMonitor("10.20.30.40", "tester.test",
                      "http://tester.test:8888/path", 3128)
     hm._follow = "sticky"
     hm._proxyIp = "10.10.10.10"
     hm._hostnameIp.append("10.20.30.50")
     hm.makeURL()
     agent = RedirectAgentZ(Agent,
                            onRedirect=hm._follow,
                            port=hm._port,
                            proxy=hm._proxyIp)
     self.assertEqual(agent._resolveLocation(hm._reqURL, location),
                      "http://tester.test/")