diff --git a/example/agents/tests/features/test_chat_controller.py b/example/agents/tests/features/test_chat_controller.py index e69de29b..39f46ca6 100644 --- a/example/agents/tests/features/test_chat_controller.py +++ b/example/agents/tests/features/test_chat_controller.py @@ -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."} + ) diff --git a/example/agents/tests/features/test_home_controller.py b/example/agents/tests/features/test_home_controller.py new file mode 100644 index 00000000..43c66662 --- /dev/null +++ b/example/agents/tests/features/test_home_controller.py @@ -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)