mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 02:10:59 +00:00
Fix the test for websocket connection.
This commit is contained in:
parent
7516f706b4
commit
37fea267c1
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user