From 4485f55d538d9347523f0c91c9c48dbc9b8b7a3e Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 12 Jun 2023 09:51:32 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20chore(test=5Fwebsocket.py):=20re?= =?UTF-8?q?move=20outdated=20test=5Fchat=5Fhistory=20test=20The=20test=5Fc?= =?UTF-8?q?hat=5Fhistory=20test=20is=20outdated=20and=20no=20longer=20work?= =?UTF-8?q?s=20with=20the=20current=20implementation=20of=20the=20applicat?= =?UTF-8?q?ion.=20It=20has=20been=20removed=20to=20avoid=20confusion=20and?= =?UTF-8?q?=20to=20keep=20the=20test=20suite=20clean.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/test_websocket.py | 66 +++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/tests/test_websocket.py b/tests/test_websocket.py index 611faff79..e540e1de3 100644 --- a/tests/test_websocket.py +++ b/tests/test_websocket.py @@ -10,38 +10,40 @@ def test_websocket_connection(client: TestClient): assert websocket.scope["path"] == "/api/v1/chat/test_client" -def test_chat_history(client: TestClient): - # Mock the process_graph function to return a specific value - with patch("langflow.chat.manager.process_graph") as mock_process_graph: - mock_process_graph.return_value = ("Hello, I'm a mock response!", "") +# This does not work anymore because now we require +# the flow to be built before sending messages +# def test_chat_history(client: TestClient): +# # Mock the process_graph function to return a specific value +# with patch("langflow.chat.manager.process_graph") as mock_process_graph: +# mock_process_graph.return_value = ("Hello, I'm a mock response!", "") - with client.websocket_connect("api/v1/chat/test_client") as websocket: - # First message should be the history - history = websocket.receive_json() - assert history == [] # Empty history - # Send a message - payload = {"message": "Hello"} - websocket.send_json(json.dumps(payload)) +# with client.websocket_connect("api/v1/chat/test_client") as websocket: +# # First message should be the history +# history = websocket.receive_json() +# assert history == [] # Empty history +# # Send a message +# payload = {"message": "Hello"} +# websocket.send_json(json.dumps(payload)) - # Receive the response from the server - response = websocket.receive_json() - assert response == { - "is_bot": True, - "message": None, - "type": "start", - "intermediate_steps": "", - "files": [], - } - # Send another message - payload = {"message": "How are you?"} - websocket.send_json(json.dumps(payload)) +# # Receive the response from the server +# response = websocket.receive_json() +# assert response == { +# "is_bot": True, +# "message": None, +# "type": "start", +# "intermediate_steps": "", +# "files": [], +# } +# # Send another message +# payload = {"message": "How are you?"} +# websocket.send_json(json.dumps(payload)) - # Receive the response from the server - response = websocket.receive_json() - assert response == { - "is_bot": True, - "message": "Hello, I'm a mock response!", - "type": "end", - "intermediate_steps": "", - "files": [], - } +# # Receive the response from the server +# response = websocket.receive_json() +# assert response == { +# "is_bot": True, +# "message": "Hello, I'm a mock response!", +# "type": "end", +# "intermediate_steps": "", +# "files": [], +# }