diff options
Diffstat (limited to 'test/mitmproxy/addons/test_anticomp.py')
-rw-r--r-- | test/mitmproxy/addons/test_anticomp.py | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/test/mitmproxy/addons/test_anticomp.py b/test/mitmproxy/addons/test_anticomp.py index 761c467a..eaf8fe53 100644 --- a/test/mitmproxy/addons/test_anticomp.py +++ b/test/mitmproxy/addons/test_anticomp.py @@ -2,23 +2,19 @@ from mitmproxy.test import tflow from .. import mastertest from mitmproxy.addons import anticomp -from mitmproxy import master -from mitmproxy import options -from mitmproxy import proxy +from mitmproxy.test import taddons class TestAntiComp(mastertest.MasterTest): def test_simple(self): - o = options.Options(anticomp = True) - m = master.Master(o, proxy.DummyServer()) sa = anticomp.AntiComp() - m.addons.add(sa) + with taddons.context() as tctx: + f = tflow.tflow(resp=True) + sa.request(f) - f = tflow.tflow(resp=True) - m.request(f) + tctx.configure(sa, anticomp=True) + f = tflow.tflow(resp=True) - f = tflow.tflow(resp=True) - - f.request.headers["Accept-Encoding"] = "foobar" - m.request(f) - assert f.request.headers["Accept-Encoding"] == "identity" + f.request.headers["Accept-Encoding"] = "foobar" + sa.request(f) + assert f.request.headers["Accept-Encoding"] == "identity" |