diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/mitmproxy/addons/test_onboarding.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/test/mitmproxy/addons/test_onboarding.py b/test/mitmproxy/addons/test_onboarding.py index 42a3b574..474e6c3c 100644 --- a/test/mitmproxy/addons/test_onboarding.py +++ b/test/mitmproxy/addons/test_onboarding.py @@ -1,5 +1,8 @@ +import pytest + from mitmproxy.addons import onboarding from mitmproxy.test import taddons +from mitmproxy import options from .. import tservers @@ -12,10 +15,21 @@ class TestApp(tservers.HTTPProxyTest): tctx.configure(self.addons()[0]) assert self.app("/").status_code == 200 - def test_cert(self): + @pytest.mark.parametrize("ext", ["pem", "p12"]) + def test_cert(self, ext): + with taddons.context() as tctx: + tctx.configure(self.addons()[0]) + resp = self.app("/cert/%s" % ext) + assert resp.status_code == 200 + assert resp.content + + @pytest.mark.parametrize("ext", ["pem", "p12"]) + def test_head(self, ext): with taddons.context() as tctx: tctx.configure(self.addons()[0]) - for ext in ["pem", "p12"]: - resp = self.app("/cert/%s" % ext) + p = self.pathoc() + with p.connect(): + resp = p.request("head:'http://%s/cert/%s'" % (options.APP_HOST, ext)) assert resp.status_code == 200 - assert resp.content + assert "Content-Length" in resp.headers + assert not resp.content |