2023-08-14 11:37:20 +00:00
|
|
|
from unittest.mock import patch
|
|
|
|
|
|
|
|
from llm_chat.chat import Chat
|
|
|
|
|
|
|
|
|
2023-08-16 09:10:06 +00:00
|
|
|
def test_send_message() -> None:
|
2023-08-14 11:37:20 +00:00
|
|
|
with patch("llm_chat.chat.Chat._make_request") as mock_make_request:
|
2023-08-16 09:10:06 +00:00
|
|
|
mock_make_request.return_value = {
|
|
|
|
"choices": [{"message": {"content": "Hello!"}}]
|
|
|
|
}
|
2023-08-14 11:37:20 +00:00
|
|
|
conversation = Chat()
|
|
|
|
response = conversation.send_message("Hello")
|
|
|
|
assert isinstance(response, str)
|
|
|
|
assert response == "Hello!"
|