aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMaximilian Hils <git@maximilianhils.com>2017-07-05 16:25:38 +0200
committerGitHub <noreply@github.com>2017-07-05 16:25:38 +0200
commit062a58f848c80b3a5f499d407396998ba253202c (patch)
tree29af51e332bb8d103a786d2f85dcf31f25516ebf /test
parent55a20b819e1220024a66bd11275a5c3511f7d295 (diff)
parent37fea267c1d171fb661736b96db62943e7b49791 (diff)
downloadmitmproxy-062a58f848c80b3a5f499d407396998ba253202c.tar.gz
mitmproxy-062a58f848c80b3a5f499d407396998ba253202c.tar.bz2
mitmproxy-062a58f848c80b3a5f499d407396998ba253202c.zip
Merge pull request #2423 from MatthewShao/mitmweb-options
[web] [WIP] Mitmweb options editor content
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_optmanager.py1
-rw-r--r--test/mitmproxy/tools/web/test_app.py28
2 files changed, 25 insertions, 4 deletions
diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py
index 0c400683..7b4ffb8b 100644
--- a/test/mitmproxy/test_optmanager.py
+++ b/test/mitmproxy/test_optmanager.py
@@ -341,6 +341,7 @@ def test_dump_defaults():
def test_dump_dicts():
o = options.Options()
assert optmanager.dump_dicts(o)
+ assert optmanager.dump_dicts(o, ['http2', 'anticomp'])
class TTypes(optmanager.OptManager):
diff --git a/test/mitmproxy/tools/web/test_app.py b/test/mitmproxy/tools/web/test_app.py
index e6d563e7..bb439b34 100644
--- a/test/mitmproxy/tools/web/test_app.py
+++ b/test/mitmproxy/tools/web/test_app.py
@@ -255,8 +255,8 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
def test_options(self):
j = json(self.fetch("/options"))
- assert type(j) == list
- assert type(j[0]) == dict
+ assert type(j) == dict
+ assert type(j['anticache']) == dict
def test_option_update(self):
assert self.put_json("/options", {"anticache": True}).code == 200
@@ -275,12 +275,32 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
ws_client = yield websocket.websocket_connect(ws_url)
self.master.options.anticomp = True
- response = yield ws_client.read_message()
- assert _json.loads(response) == {
+ r1 = yield ws_client.read_message()
+ 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
+ assert response['settings'] == {
"resource": "settings",
"cmd": "update",
"data": {"anticomp": True},
}
+ assert response['options'] == {
+ "resource": "options",
+ "cmd": "update",
+ "data": {
+ "anticomp": {
+ "value": True,
+ "choices": None,
+ "default": False,
+ "help": "Try to convince servers to send us un-compressed data.",
+ "type": "bool",
+ }
+ }
+ }
ws_client.close()
# trigger on_close by opening a second connection.