🔥 chore(test_websocket.py): remove outdated test_chat_history test

The test_chat_history test is outdated and no longer works with the current implementation of the application. It has been removed to avoid confusion and to keep the test suite clean.
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-06-12 09:51:32 -03:00
commit 4485f55d53

View file

@ -10,38 +10,40 @@ def test_websocket_connection(client: TestClient):
assert websocket.scope["path"] == "/api/v1/chat/test_client" assert websocket.scope["path"] == "/api/v1/chat/test_client"
def test_chat_history(client: TestClient): # This does not work anymore because now we require
# Mock the process_graph function to return a specific value # the flow to be built before sending messages
with patch("langflow.chat.manager.process_graph") as mock_process_graph: # def test_chat_history(client: TestClient):
mock_process_graph.return_value = ("Hello, I'm a mock response!", "") # # 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: # with client.websocket_connect("api/v1/chat/test_client") as websocket:
# First message should be the history # # First message should be the history
history = websocket.receive_json() # history = websocket.receive_json()
assert history == [] # Empty history # assert history == [] # Empty history
# Send a message # # Send a message
payload = {"message": "Hello"} # payload = {"message": "Hello"}
websocket.send_json(json.dumps(payload)) # websocket.send_json(json.dumps(payload))
# Receive the response from the server # # Receive the response from the server
response = websocket.receive_json() # response = websocket.receive_json()
assert response == { # assert response == {
"is_bot": True, # "is_bot": True,
"message": None, # "message": None,
"type": "start", # "type": "start",
"intermediate_steps": "", # "intermediate_steps": "",
"files": [], # "files": [],
} # }
# Send another message # # Send another message
payload = {"message": "How are you?"} # payload = {"message": "How are you?"}
websocket.send_json(json.dumps(payload)) # websocket.send_json(json.dumps(payload))
# Receive the response from the server # # Receive the response from the server
response = websocket.receive_json() # response = websocket.receive_json()
assert response == { # assert response == {
"is_bot": True, # "is_bot": True,
"message": "Hello, I'm a mock response!", # "message": "Hello, I'm a mock response!",
"type": "end", # "type": "end",
"intermediate_steps": "", # "intermediate_steps": "",
"files": [], # "files": [],
} # }