Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions example/agents/tests/features/test_chat_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from app.agents.chat import ChatAgent

from tests.test_case import TestCase


class TestChatController(TestCase):
@ChatAgent.fake({"*hello*": "Hello there!, Hope you are doing well."})
async def test_chat_responds_for_basic_greetings(self):
response = await self.post("/chat", json={"message": "hello"})

self.assertEqual(response.status_code, 200)
self.assertEqual(
response.json(), {"content": "Hello there!, Hope you are doing well."}
)

@ChatAgent.record('other_greetings.json')
async def test_chat_responds_for_other_greetings(self):
response = await self.post("/chat", json={
"message": "Hi, I am Bedram, This is unittest, Please respond by calling my name."
})

self.assertEqual(response.status_code, 200)
self.assertEqual(
response.json(), {"content": "Hello there!, Hope you are doing well."}
)
8 changes: 8 additions & 0 deletions example/agents/tests/features/test_home_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from tests.test_case import TestCase


class TestHomeController(TestCase):
async def test_home(self) -> None:
response = await self.get("/")

self.assertEqual(response.status_code, 200)
Loading