mitmproxy/test/test_app.py

20 lines
641 B
Python
Raw Normal View History

2014-02-07 03:15:24 +00:00
import mock, socket, os, time
2014-02-07 01:36:39 +00:00
from libmproxy import dump
2014-02-07 03:15:24 +00:00
from netlib import certutils, tcp
2014-02-07 01:36:39 +00:00
from libpathod.pathoc import Pathoc
import tutils, tservers
2014-02-07 01:36:39 +00:00
class TestApp(tservers.HTTPProxTest):
2014-02-07 01:36:39 +00:00
def test_basic(self):
assert self.app("/").status_code == 200
2014-02-07 01:36:39 +00:00
def test_cert(self):
path = tutils.test_data.path("data/confdir/") + "mitmproxy-ca-cert."
2014-02-07 01:36:39 +00:00
with tutils.tmpdir() as d:
for ext in ["pem", "p12"]:
resp = self.app("/cert/%s" % ext)
2014-02-07 01:36:39 +00:00
assert resp.status_code == 200
with open(path + ext, "rb") as f:
2014-02-07 01:36:39 +00:00
assert resp.content == f.read()