Coverage for tests/test_chat_route.py: 100%
13 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-20 21:23 +0000
« prev ^ index » next coverage.py v7.8.0, created at 2025-04-20 21:23 +0000
1def test_chat_message_valid(client):
2 # Test sending a valid message to the chat route
3 response = client.post("/chat", json={"message": "Hello, chatbot!", "conversationHistory": []})
5 # Check for status code and response
6 assert response.status_code == 200
7 json_data = response.get_json()
8 assert "response" in json_data
9 assert json_data["response"] != ""
10 assert json_data["response"] != None
13def test_chat_message_missing(client):
14 # Test sending a request with no message
15 response = client.post("/chat", json={})
17 # Check for status code and error response
18 assert response.status_code == 400
19 json_data = response.get_json()
20 assert "error" in json_data
21 assert json_data["error"] == "Message is required"