aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/mitmproxy/test_optmanager.py4
-rw-r--r--test/mitmproxy/tools/web/test_app.py13
-rw-r--r--web/src/js/__tests__/components/Modal/__snapshots__/ModalSpec.js.snap29
3 files changed, 44 insertions, 2 deletions
diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py
index 7b4ffb8b..3b38162f 100644
--- a/test/mitmproxy/test_optmanager.py
+++ b/test/mitmproxy/test_optmanager.py
@@ -285,6 +285,10 @@ def test_saving(tmpdir):
optmanager.load_paths(o, dst)
assert o.three == "foo"
+ o2 = TD2()
+ o2.three = "foo"
+ assert(optmanager.save(o2, None, defaults=False)) == "three: foo\n"
+
with open(dst, 'a') as f:
f.write("foobar: '123'")
assert optmanager.load_paths(o, dst) == {"foobar": "123"}
diff --git a/test/mitmproxy/tools/web/test_app.py b/test/mitmproxy/tools/web/test_app.py
index bb439b34..bb0b1907 100644
--- a/test/mitmproxy/tools/web/test_app.py
+++ b/test/mitmproxy/tools/web/test_app.py
@@ -263,6 +263,18 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
assert self.put_json("/options", {"wtf": True}).code == 400
assert self.put_json("/options", {"anticache": "foo"}).code == 400
+ def test_option_dump(self):
+ resp = self.fetch("/options/dump")
+ assert b"http2: false" in resp.body
+
+ assert self.fetch("/options/dump", method="POST", body=b"http2: true").code == 200
+ j = json(self.fetch("/options"))
+ assert j["http2"]["value"]
+
+ resp = self.fetch("/options/dump", method="POST", body=b"wtf: true")
+ assert resp.code == 400
+ assert resp.body == b"'Unknown options: wtf'"
+
def test_err(self):
with mock.patch("mitmproxy.tools.web.app.IndexHandler.get") as f:
f.side_effect = RuntimeError
@@ -279,7 +291,6 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
r2 = yield ws_client.read_message()
j1 = _json.loads(r1)
j2 = _json.loads(r2)
- print(j1)
response = dict()
response[j1['resource']] = j1
response[j2['resource']] = j2
diff --git a/web/src/js/__tests__/components/Modal/__snapshots__/ModalSpec.js.snap b/web/src/js/__tests__/components/Modal/__snapshots__/ModalSpec.js.snap
index 0b904c07..92dad72b 100644
--- a/web/src/js/__tests__/components/Modal/__snapshots__/ModalSpec.js.snap
+++ b/web/src/js/__tests__/components/Modal/__snapshots__/ModalSpec.js.snap
@@ -246,7 +246,34 @@ exports[`Modal Component should render correctly 2`] = `
</div>
<div
className="modal-footer"
- />
+ >
+ <button
+ className="btn btn-default"
+ onClick={[Function]}
+ type="button"
+ >
+ <i
+ className="fa fa-download"
+ />
+ Download
+ </button>
+ <a
+ className="btn btn-primary"
+ href="#"
+ onClick={[Function]}
+ title={undefined}
+ >
+ <i
+ className="fa fa-fw fa-upload"
+ />
+ Load
+ <input
+ className="hidden"
+ onChange={[Function]}
+ type="file"
+ />
+ </a>
+ </div>
</div>
</div>
</div>