feat: Add chat webhook
This commit is contained in:
@@ -3,6 +3,18 @@ from unittest.mock import Mock
|
||||
|
||||
from src.naliiabot.bot.agent.agent import Agent, AgentConfig
|
||||
from src.naliiabot.bot.factories.llm_factory import LLMFactory
|
||||
from httpx import ASGITransport, AsyncClient
|
||||
from naliiabotapi.main import app
|
||||
|
||||
@pytest.fixture(scope="function")
|
||||
async def async_client():
|
||||
"""Fixture para un cliente HTTP asíncrono."""
|
||||
|
||||
async with AsyncClient(
|
||||
transport=ASGITransport(app=app),
|
||||
base_url="http://localhost:8010") as client:
|
||||
|
||||
yield client
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
||||
12
tests/test_webhook.py
Normal file
12
tests/test_webhook.py
Normal file
@@ -0,0 +1,12 @@
|
||||
import pytest
|
||||
|
||||
|
||||
class TestWebhookChatBot:
|
||||
"""Tests for WebhookChatBot."""
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def tests_webhook_success(self, async_client):
|
||||
"""Test that the webhook endpoint returns a successful response."""
|
||||
response = await async_client.post("/webhook", json={"message": "Hello"})
|
||||
assert response.status_code == 200
|
||||
assert response.json() == {"reply": "Hello, how can I assist you?"}
|
||||
Reference in New Issue
Block a user