From 877119544d2eae00779450370c68994290bdba1a Mon Sep 17 00:00:00 2001 From: monst Date: Thu, 12 Oct 2023 12:52:17 +0200 Subject: [PATCH] Add message test for v2 api --- tests/routes/messages_test.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/routes/messages_test.py b/tests/routes/messages_test.py index a9b77ce5..b3b98368 100644 --- a/tests/routes/messages_test.py +++ b/tests/routes/messages_test.py @@ -50,9 +50,19 @@ def test_send_message(test_client, headers, mocker): "query": "Some query", }, } - response = test_client.post("/api/v1/messages", headers=headers, json=body) - assert response.status_code == 200 - assert response.json() == { + response_v1 = test_client.post("/api/v1/messages", headers=headers, json=body) + assert response_v1.status_code == 200 + assert response_v1.json() == { + "usedModel": "GPT35_TURBO", + "message": { + "sentAt": "2023-06-16T01:21:34+00:00", + "content": [{"textContent": "some content", "type": "text"}], + }, + } + + response_v2 = test_client.post("/api/v2/messages", headers=headers, json=body) + assert response_v2.status_code == 200 + assert response_v2.json() == { "usedModel": "GPT35_TURBO", "sentAt": "2023-06-16T01:21:34+00:00", "content": {