diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py index 7b4ffb8b0..3b38162fc 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 bb439b340..bb0b19073 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 0b904c076..92dad72b8 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`] = `
+ > + + + + Load + + +