feat(api): Implement create conversation endpoint
This commit is contained in:
@@ -41,6 +41,27 @@ def test_get_conversations_success(auth_header, mock_user):
|
||||
assert len(response.json()) == 1
|
||||
assert response.json()[0]["name"] == "Conv 1"
|
||||
|
||||
def test_create_conversation_success(auth_header, mock_user):
|
||||
"""Test creating a new conversation."""
|
||||
with patch("ea_chatbot.api.routers.history.history_manager") as mock_hm:
|
||||
mock_hm.create_conversation.return_value = Conversation(
|
||||
id="c2",
|
||||
name="New Conv",
|
||||
user_id=mock_user.id,
|
||||
data_state="nj",
|
||||
created_at=datetime.now(timezone.utc)
|
||||
)
|
||||
|
||||
response = client.post(
|
||||
"/conversations",
|
||||
json={"name": "New Conv"},
|
||||
headers=auth_header
|
||||
)
|
||||
|
||||
assert response.status_code == 201
|
||||
assert response.json()["name"] == "New Conv"
|
||||
assert response.json()["id"] == "c2"
|
||||
|
||||
def test_get_messages_success(auth_header):
|
||||
"""Test retrieving messages for a conversation."""
|
||||
with patch("ea_chatbot.api.routers.history.history_manager") as mock_hm:
|
||||
|
||||
Reference in New Issue
Block a user