@@ -80,7 +80,7 @@ class TestSafetyAgentSettings:
8080 def test_default_settings (self ):
8181 """Test default settings values."""
8282 settings = SafetyAgentSettings ()
83- assert settings .service_url == "http://localhost:8001 "
83+ assert settings .service_url == "http://localhost:8002 "
8484 assert settings .timeout_seconds == 10.0
8585 assert settings .enable_escalation is True
8686 assert settings .fallback_on_service_error is True
@@ -112,7 +112,7 @@ def test_to_dict(self):
112112 )
113113 data = request .to_dict ()
114114 assert data ["user_id" ] == "user-1"
115- assert data ["check_type" ] == "PRE_CHECK "
115+ assert data ["check_type" ] == "pre_check "
116116 assert data ["include_resources" ] is True
117117
118118
@@ -179,7 +179,7 @@ def test_initialization(self):
179179 """Test agent initialization."""
180180 agent = SafetyAgent ()
181181 assert agent ._check_count == 0
182- assert agent ._settings .service_url == "http://localhost:8001 "
182+ assert agent ._settings .service_url == "http://localhost:8002 "
183183
184184 def test_build_fallback_response_crisis (self ):
185185 """Test fallback response for crisis message."""
@@ -685,38 +685,42 @@ def test_initialization(self):
685685 agent = ChatAgent ()
686686 assert agent ._message_count == 0
687687
688- def test_process_greeting (self ):
688+ @pytest .mark .asyncio
689+ async def test_process_greeting (self ):
689690 """Test processing greeting message."""
690691 agent = ChatAgent ()
691692 state = create_initial_state ("user-1" , "session-1" , "Hello!" )
692- result = agent .process (state )
693+ result = await agent .process (state )
693694 assert "agent_results" in result
694695 agent_result = result ["agent_results" ][0 ]
695696 assert agent_result ["agent_type" ] == AgentType .CHAT .value
696697 assert agent_result ["success" ] is True
697698 assert "response_content" in agent_result
698699
699- def test_process_farewell (self ):
700+ @pytest .mark .asyncio
701+ async def test_process_farewell (self ):
700702 """Test processing farewell message."""
701703 agent = ChatAgent ()
702704 state = create_initial_state ("user-1" , "session-1" , "Goodbye!" )
703- result = agent .process (state )
705+ result = await agent .process (state )
704706 agent_result = result ["agent_results" ][0 ]
705707 assert "take care" in agent_result ["response_content" ].lower ()
706708
707- def test_process_with_personality_style (self ):
709+ @pytest .mark .asyncio
710+ async def test_process_with_personality_style (self ):
708711 """Test processing with personality style."""
709712 agent = ChatAgent ()
710713 state = create_initial_state ("user-1" , "session-1" , "Hello!" )
711714 state ["personality_style" ] = {"warmth" : 0.9 , "validation_level" : 0.8 }
712- result = agent .process (state )
715+ result = await agent .process (state )
713716 agent_result = result ["agent_results" ][0 ]
714717 assert agent_result ["success" ] is True
715718
716- def test_get_statistics (self ):
719+ @pytest .mark .asyncio
720+ async def test_get_statistics (self ):
717721 """Test statistics retrieval."""
718722 agent = ChatAgent ()
719- agent .process (create_initial_state ("user-1" , "session-1" , "Hi" ))
723+ await agent .process (create_initial_state ("user-1" , "session-1" , "Hi" ))
720724 stats = agent .get_statistics ()
721725 assert stats ["total_messages" ] == 1
722726
@@ -728,10 +732,11 @@ def test_get_statistics(self):
728732class TestNodeFunctions :
729733 """Tests for LangGraph node functions."""
730734
731- def test_chat_agent_node (self ):
735+ @pytest .mark .asyncio
736+ async def test_chat_agent_node (self ):
732737 """Test chat_agent_node function."""
733738 state = create_initial_state ("user-1" , "session-1" , "Hello!" )
734- result = chat_agent_node (state )
739+ result = await chat_agent_node (state )
735740 assert "agent_results" in result
736741 assert result ["agent_results" ][0 ]["agent_type" ] == AgentType .CHAT .value
737742
@@ -779,23 +784,25 @@ async def test_personality_agent_node_fallback(self):
779784class TestAgentIntegration :
780785 """Integration tests for agent coordination."""
781786
782- def test_chat_agent_with_initial_state (self ):
787+ @pytest .mark .asyncio
788+ async def test_chat_agent_with_initial_state (self ):
783789 """Test chat agent with properly initialized state."""
784790 state = create_initial_state (
785791 user_id = "user-123" ,
786792 session_id = "session-456" ,
787793 message = "How are you today?" ,
788794 )
789795 agent = ChatAgent ()
790- result = agent .process (state )
796+ result = await agent .process (state )
791797 assert result ["agent_results" ][0 ]["success" ] is True
792798 assert "metadata" in result ["agent_results" ][0 ]
793799
794- def test_multiple_agents_state_updates (self ):
800+ @pytest .mark .asyncio
801+ async def test_multiple_agents_state_updates (self ):
795802 """Test that agent state updates are compatible."""
796803 state = create_initial_state ("user-1" , "session-1" , "Hello!" )
797804 chat_agent = ChatAgent ()
798- chat_result = chat_agent .process (state )
805+ chat_result = await chat_agent .process (state )
799806 assert "agent_results" in chat_result
800807 assert isinstance (chat_result ["agent_results" ], list )
801808
0 commit comments