diff options
5 files changed, 20 insertions, 41 deletions
diff --git a/test/mitmproxy/tools/test_dump.py b/test/mitmproxy/tools/test_dump.py index 69a76d2e..597333af 100644 --- a/test/mitmproxy/tools/test_dump.py +++ b/test/mitmproxy/tools/test_dump.py @@ -12,7 +12,7 @@ from .. import tservers class TestDumpMaster(tservers.MasterTest): def mkmaster(self, flt, **opts): - o = options.Options(view_filter=flt, verbosity=-1, flow_detail=0, **opts) + o = options.Options(view_filter=flt, verbosity='error', flow_detail=0, **opts) m = dump.DumpMaster(o, proxy.DummyServer(), with_termlog=False, with_dumper=False) return m diff --git a/test/mitmproxy/tools/web/test_app.py b/test/mitmproxy/tools/web/test_app.py index bb0b1907..119d7b1d 100644 --- a/test/mitmproxy/tools/web/test_app.py +++ b/test/mitmproxy/tools/web/test_app.py @@ -264,16 +264,7 @@ class TestApp(tornado.testing.AsyncHTTPTestCase): 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'" + assert self.fetch("/options/dump", method="POST").code == 200 def test_err(self): with mock.patch("mitmproxy.tools.web.app.IndexHandler.get") as f: 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 92dad72b..8d9271f1 100644 --- a/web/src/js/__tests__/components/Modal/__snapshots__/ModalSpec.js.snap +++ b/web/src/js/__tests__/components/Modal/__snapshots__/ModalSpec.js.snap @@ -117,7 +117,7 @@ exports[`Modal Component should render correctly 2`] = ` name="choiceOption" onChange={[Function]} onKeyDown={[Function]} - selected="b" + value="b" > <option value="a" @@ -246,34 +246,7 @@ 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> diff --git a/web/src/js/__tests__/components/Modal/__snapshots__/OptionSpec.js.snap b/web/src/js/__tests__/components/Modal/__snapshots__/OptionSpec.js.snap index 514e0eb5..257bddce 100644 --- a/web/src/js/__tests__/components/Modal/__snapshots__/OptionSpec.js.snap +++ b/web/src/js/__tests__/components/Modal/__snapshots__/OptionSpec.js.snap @@ -18,7 +18,7 @@ exports[`BooleanOption Component should render correctly 1`] = ` exports[`ChoiceOption Component should render correctly 1`] = ` <select onChange={[Function]} - selected="a" + value="a" > <option value="a" diff --git a/web/src/js/__tests__/ducks/optionsSpec.js b/web/src/js/__tests__/ducks/optionsSpec.js index 0925fcc1..a0d11f9c 100644 --- a/web/src/js/__tests__/ducks/optionsSpec.js +++ b/web/src/js/__tests__/ducks/optionsSpec.js @@ -49,3 +49,18 @@ describe('sendUpdate', () => { ]) }) }) + +describe('dump', () => { + + it('should dump options', () => { + global.fetch = jest.fn() + store.dispatch(OptionsActions.dump()) + expect(fetch).toBeCalledWith( + '/options/dump?_xsrf=undefined', + { + credentials: "same-origin", + method: "POST" + } + ) + }) +}) |