mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 00:01:36 +00:00
Add test for POST /options API of mitmweb.
This commit is contained in:
parent
ab162361a1
commit
c7ce7f84e6
@ -451,7 +451,6 @@ class Options(RequestHandler):
|
||||
raise APIError(400, "{}".format(err))
|
||||
|
||||
|
||||
|
||||
class Application(tornado.web.Application):
|
||||
def __init__(self, master, debug):
|
||||
self.master = master
|
||||
|
@ -258,6 +258,10 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
|
||||
assert type(j) == list
|
||||
assert type(j[0]) == dict
|
||||
|
||||
def test_option_update(self):
|
||||
assert self.put_json("/options", {"anticache": True}).code == 200
|
||||
assert self.put_json("/options", {"wtf": True}).code == 400
|
||||
|
||||
def test_err(self):
|
||||
with mock.patch("mitmproxy.tools.web.app.IndexHandler.get") as f:
|
||||
f.side_effect = RuntimeError
|
||||
|
Loading…
Reference in New Issue
Block a user