Skip to content

Commit

Permalink
[#113] Update test incoming message with system auto reply
Browse files Browse the repository at this point in the history
  • Loading branch information
wayangalihpratama committed Oct 18, 2024
1 parent e12856f commit 82c80fd
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions backend/tests/websockets/test_handle_incoming_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Chat,
Chat_Session,
Client,
Sender_Role_Enum,
)
from models import Chat_Media

Expand All @@ -27,7 +28,9 @@


@pytest.mark.asyncio
async def test_handle_incoming_message_new_conversation(session: Session):
async def test_handle_incoming_message_new_conversation_n_send_initial_message(
session: Session,
):
await handle_incoming_message(session=session, message=MESSAGE)

new_client = session.exec(
Expand All @@ -42,8 +45,13 @@ async def test_handle_incoming_message_new_conversation(session: Session):

new_chat = session.exec(
select(Chat).where(Chat.chat_session_id == new_chat_session.id)
).first()
assert new_chat.message == "Test message!"
).all()
assert new_chat[0].message == "Test message!"
assert new_chat[0].sender_role == Sender_Role_Enum.CLIENT
assert new_chat[1].message.startswith(
"Hi 6281222304050, I'm 12345678900 the extension officer."
)
assert new_chat[1].sender_role == Sender_Role_Enum.SYSTEM


@pytest.mark.asyncio
Expand Down

0 comments on commit 82c80fd

Please sign in to comment.