This commit is contained in:
Maximilian Hils 2021-08-23 11:48:27 +02:00
parent 7219284d44
commit d55aa7ea42
2 changed files with 17 additions and 7 deletions

View File

@ -244,6 +244,13 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
assert f.response.headers["bar"] == "baz" assert f.response.headers["bar"] == "baz"
assert f.response.text == "resp" 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() f.revert()
assert self.put_json("/flows/42", {"foo": 42}).code == 400 assert self.put_json("/flows/42", {"foo": 42}).code == 400
@ -257,13 +264,6 @@ class TestApp(tornado.testing.AsyncHTTPTestCase):
body="!!" body="!!"
).code == 400 ).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): def test_flow_duplicate(self):
resp = self.fetch("/flows/42/duplicate", method="POST") resp = self.fetch("/flows/42/duplicate", method="POST")
assert resp.code == 200 assert resp.code == 200

View File

@ -49,7 +49,17 @@ test("websocket backend", async () => {
{type: "EVENTS_RECEIVE", cmd: "receive", data: [], resource: "events"}, {type: "EVENTS_RECEIVE", cmd: "receive", data: [], resource: "events"},
connectionActions.connectionEstablished(), connectionActions.connectionEstablished(),
])) ]))
store.clearActions()
expect(fetchMock.mock.calls).toHaveLength(4); 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(); jest.restoreAllMocks();
}); });