def test_websocket_patch(websocket_service: WebsocketService,
                         expected_response, side_effect, path, regex):
    patch = websocket_service.patch(side_effect, path, regex=regex)

    with patch:
        conn = _connect(websocket_service)
        assert conn.recv() == expected_response
def test_websocket_double_patch(websocket_service: WebsocketService):
    with websocket_service.patch("test", "test"), raises(RuntimeError), \
            websocket_service.patch("test", "test"):
        pass