From c7ce7f84e6283fa08e87ee5ee35fd6053a2ab615 Mon Sep 17 00:00:00 2001 From: Matthew Shao Date: Fri, 23 Jun 2017 10:45:04 +0800 Subject: Add test for POST /options API of mitmweb. --- mitmproxy/tools/web/app.py | 1 - test/mitmproxy/tools/web/test_app.py | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/mitmproxy/tools/web/app.py b/mitmproxy/tools/web/app.py index ad8e5d2a..8b4a39b6 100644 --- a/mitmproxy/tools/web/app.py +++ b/mitmproxy/tools/web/app.py @@ -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 diff --git a/test/mitmproxy/tools/web/test_app.py b/test/mitmproxy/tools/web/test_app.py index d47b1af0..401f9fe6 100644 --- a/test/mitmproxy/tools/web/test_app.py +++ b/test/mitmproxy/tools/web/test_app.py @@ -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 -- cgit v1.2.3