@@ -529,18 +529,34 @@ async def test_static_method_properties(self):
529529 result = await PlanService .handle_plan_approval (mock_approval , "user" )
530530 assert result is False
531531
532- def test_event_tracking_calls (self ):
532+ @pytest .mark .asyncio
533+ async def test_event_tracking_calls (self ):
533534 """Test that event tracking is called appropriately."""
534- # This test verifies the event tracking integration
535- with patch .object (mock_event_utils , 'track_event_if_configured' ) as mock_track :
535+ # Seed orchestration plan + memory store so approval path reaches event tracking.
536+ mock_mplan = MagicMock ()
537+ mock_mplan .plan_id = None
538+ mock_mplan .team_id = None
539+ mock_mplan .model_dump .return_value = {"test" : "plan" }
540+ mock_orchestration_config .plans = {"test-m-plan" : mock_mplan }
541+
542+ mock_plan = MagicMock ()
543+ mock_plan .team_id = "team-123"
544+ mock_db = MagicMock ()
545+ mock_db .get_plan = AsyncMock (return_value = mock_plan )
546+ mock_db .update_plan = AsyncMock ()
547+ mock_database_factory .DatabaseFactory .get_database = AsyncMock (return_value = mock_db )
548+
549+ with patch .object (plan_service_module , 'track_event_if_configured' ) as mock_track :
536550 mock_approval = MockPlanApprovalResponse (
537551 plan_id = "test-plan" ,
538552 m_plan_id = "test-m-plan" ,
539553 approved = True
540554 )
541-
542- # The actual event tracking calls are tested indirectly through the service methods
543- assert mock_track is not None
555+
556+ result = await PlanService .handle_plan_approval (mock_approval , "user" )
557+ assert result is True
558+ # Verify that event tracking was invoked
559+ mock_track .assert_called_once ()
544560
545561 def test_logging_integration (self ):
546562 """Test that logging is properly configured."""
0 commit comments