diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_server.py | 2 | ||||
-rw-r--r-- | test/tutils.py | 31 |
2 files changed, 32 insertions, 1 deletions
diff --git a/test/test_server.py b/test/test_server.py index e54d3559..8878cf32 100644 --- a/test/test_server.py +++ b/test/test_server.py @@ -32,7 +32,7 @@ class TestReverse(tutils.ReverseProxTest, SanityMixin): reverse = True -class _TestTransparent(): +class TestTransparent(tutils.TransparentProxTest, SanityMixin): transparent = True diff --git a/test/tutils.py b/test/tutils.py index 2556a57b..5d96d934 100644 --- a/test/tutils.py +++ b/test/tutils.py @@ -147,6 +147,37 @@ class HTTPProxTest(ProxTestBase): ) +class TResolver: + def __init__(self, port): + self.port = port + + def original_addr(self, sock): + return ("127.0.0.1", self.port) + + +class TransparentProxTest(ProxTestBase): + ssl = None + @classmethod + def get_proxy_config(cls): + return dict( + transparent_proxy = dict( + resolver = TResolver(cls.server.port), + sslports = [] + ) + ) + + def pathod(self, spec): + """ + Constructs a pathod request, with the appropriate base and proxy. + """ + r = hurl.get( + "http://127.0.0.1:%s"%self.proxy.port + "/p/" + spec, + validate_cert=False, + #debug=hurl.utils.stdout_debug + ) + return r + + class ReverseProxTest(ProxTestBase): ssl = None @classmethod |