mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 07:08:10 +00:00
tests++
This commit is contained in:
parent
7219284d44
commit
d55aa7ea42
@ -244,6 +244,13 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
|
||||
assert f.response.headers["bar"] == "baz"
|
||||
assert f.response.text == "resp"
|
||||
|
||||
upd = {
|
||||
"request": {"trailers": [("foo", "baz")], },
|
||||
"response": {"trailers": [("foo", "baz")], },
|
||||
}
|
||||
assert self.put_json("/flows/42", upd).code == 200
|
||||
assert f.request.trailers["foo"] == "baz"
|
||||
|
||||
f.revert()
|
||||
|
||||
assert self.put_json("/flows/42", {"foo": 42}).code == 400
|
||||
@ -257,13 +264,6 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
|
||||
body="!!"
|
||||
).code == 400
|
||||
|
||||
upd = {
|
||||
"request": {"trailers": [("foo", "baz")],},
|
||||
"response": {"trailers": [("foo", "baz")],},
|
||||
}
|
||||
assert self.put_json("/flows/42", upd).code == 200
|
||||
assert f.request.trailers["foo"] == "baz"
|
||||
|
||||
def test_flow_duplicate(self):
|
||||
resp = self.fetch("/flows/42/duplicate", method="POST")
|
||||
assert resp.code == 200
|
||||
|
@ -49,7 +49,17 @@ test("websocket backend", async () => {
|
||||
{type: "EVENTS_RECEIVE", cmd: "receive", data: [], resource: "events"},
|
||||
connectionActions.connectionEstablished(),
|
||||
]))
|
||||
store.clearActions()
|
||||
expect(fetchMock.mock.calls).toHaveLength(4);
|
||||
|
||||
console.error = jest.fn();
|
||||
backend.onClose(new CloseEvent("Connection closed"));
|
||||
expect(console.error).toBeCalledTimes(1);
|
||||
expect(store.getActions()[0].type).toEqual(connectionActions.ConnectionState.ERROR);
|
||||
store.clearActions();
|
||||
|
||||
backend.onError(null);
|
||||
expect(console.error).toBeCalledTimes(2);
|
||||
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user