"""Unit tests for the CleanupFiles workflow.""" from unittest.mock import AsyncMock, patch import pytest @pytest.mark.asyncio @patch('model_manager.workflows.cleanup_files.workflow') async def test_cleanup_files_workflow(mock_workflow_module): """Test the CleanupFiles workflow.""" from model_manager.runtime_paths import REPORTS_TEMP_DIR from model_manager.workflows.cleanup_files import CleanupFiles # Mock execute_activity_method mock_workflow_module.execute_activity_method = AsyncMock() # Instantiate and run the workflow workflow_instance = CleanupFiles() await workflow_instance.run({}) # Verify that the activities were called with the correct parameters calls = mock_workflow_module.execute_activity_method.call_args_list assert len(calls) == 1 # Check cleanup_temp_directories call local_call_args = calls[0][0][1] assert local_call_args['temp_path'] == REPORTS_TEMP_DIR assert local_call_args['metadata']['workflow_name'] == 'cleanup_files' assert 'pod_id' in local_call_args['metadata']