aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Shao <me@matshao.com>2017-07-05 18:57:19 +0800
committerMatthew Shao <me@matshao.com>2017-07-05 18:57:19 +0800
commit37fea267c1d171fb661736b96db62943e7b49791 (patch)
tree985b35d9f3590072462805715a17e62bffe8f976
parent7516f706b41de0c10c2bf9b88278afb6e3edcd4a (diff)
downloadmitmproxy-37fea267c1d171fb661736b96db62943e7b49791.tar.gz
mitmproxy-37fea267c1d171fb661736b96db62943e7b49791.tar.bz2
mitmproxy-37fea267c1d171fb661736b96db62943e7b49791.zip
Fix the test for websocket connection.
-rw-r--r--test/mitmproxy/tools/web/test_app.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/mitmproxy/tools/web/test_app.py b/test/mitmproxy/tools/web/test_app.py
index 044b4595..bb439b34 100644
--- a/test/mitmproxy/tools/web/test_app.py
+++ b/test/mitmproxy/tools/web/test_app.py
@@ -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.