diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2016-10-18 22:09:43 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2016-10-18 22:30:21 +1300 |
commit | 03cb5bb32503d07eda466ab8dd62e750d10d4392 (patch) | |
tree | b3c14d63b803334238bf8ccff4b2e52b8e7c0ae0 /test | |
parent | 466f5e56a156ac7506ab5523288d5a8de64a064e (diff) | |
download | mitmproxy-03cb5bb32503d07eda466ab8dd62e750d10d4392.tar.gz mitmproxy-03cb5bb32503d07eda466ab8dd62e750d10d4392.tar.bz2 mitmproxy-03cb5bb32503d07eda466ab8dd62e750d10d4392.zip |
No need for all builtins to be loaded for server tests
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/builtins/test_replace.py | 22 | ||||
-rw-r--r-- | test/mitmproxy/test_server.py | 13 | ||||
-rw-r--r-- | test/mitmproxy/tservers.py | 2 |
3 files changed, 21 insertions, 16 deletions
diff --git a/test/mitmproxy/builtins/test_replace.py b/test/mitmproxy/builtins/test_replace.py index 03943867..1f96ae6f 100644 --- a/test/mitmproxy/builtins/test_replace.py +++ b/test/mitmproxy/builtins/test_replace.py @@ -1,4 +1,4 @@ -from .. import tutils, mastertest +from .. import tutils, mastertest, tservers from mitmproxy.builtins import replace from mitmproxy.flow import master from mitmproxy import options @@ -48,3 +48,23 @@ class TestReplace(mastertest.MasterTest): f.response.content = b"foo" m.response(f) assert f.response.content == b"bar" + + +class TestUpstreamProxy(tservers.HTTPUpstreamProxyTest): + ssl = False + + def test_order(self): + sa = replace.Replace() + self.proxy.tmaster.addons.add(sa) + + self.proxy.tmaster.options.replacements = [ + ("~q", "foo", "bar"), + ("~q", "bar", "baz"), + ("~q", "foo", "oh noes!"), + ("~s", "baz", "ORLY") + ] + p = self.pathoc() + with p.connect(): + req = p.request("get:'%s/p/418:b\"foo\"'" % self.server.urlbase) + assert req.content == b"ORLY" + assert req.status_code == 418 diff --git a/test/mitmproxy/test_server.py b/test/mitmproxy/test_server.py index 0938571b..12c0b25f 100644 --- a/test/mitmproxy/test_server.py +++ b/test/mitmproxy/test_server.py @@ -900,19 +900,6 @@ class TestIncompleteResponse(tservers.HTTPProxyTest): class TestUpstreamProxy(tservers.HTTPUpstreamProxyTest, CommonMixin, AppMixin): ssl = False - def test_order(self): - self.proxy.tmaster.options.replacements = [ - ("~q", "foo", "bar"), - ("~q", "bar", "baz"), - ("~q", "foo", "oh noes!"), - ("~s", "baz", "ORLY") - ] - p = self.pathoc() - with p.connect(): - req = p.request("get:'%s/p/418:b\"foo\"'" % self.server.urlbase) - assert req.content == b"ORLY" - assert req.status_code == 418 - class TestUpstreamProxySSL( tservers.HTTPUpstreamProxyTest, diff --git a/test/mitmproxy/tservers.py b/test/mitmproxy/tservers.py index c4230d6f..e704faa4 100644 --- a/test/mitmproxy/tservers.py +++ b/test/mitmproxy/tservers.py @@ -11,7 +11,6 @@ from mitmproxy.flow import state import pathod.test import pathod.pathoc from mitmproxy import flow, controller, options -from mitmproxy import builtins import netlib.exceptions testapp = flask.Flask(__name__) @@ -38,7 +37,6 @@ class TestMaster(flow.FlowMaster): flow.FlowMaster.__init__(self, opts, s) self.state = state.State() self.addons.add(self.state) - self.addons.add(*builtins.default_addons()) self.apps.add(testapp, "testapp", 80) self.apps.add(errapp, "errapp", 80) self.clear_log() |