mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-25 18:03:50 +00:00
[web] Update tests.
This commit is contained in:
parent
c3cb77adce
commit
4282dc1ac4
@ -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
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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>
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
}
|
||||
)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user