def test_workflow_configs(workflows, expected, monkeypatch): def get_mock_config(name, config_path): workflow_mock = Mock(spec=workflow_config.WorkflowConfig) workflow_mock.name = name workflow_mock.config_path = config_path return workflow_mock config = workflow_config.WorkflowConfigs() workflows = [get_mock_config(name, config_path) for name, config_path in workflows] monkeypatch.setattr(config, "_workflows", workflows) assert config.get_workflows() == expected
def test_workflow_config_duplicate_log_message(caplog, monkeypatch): def get_mock_config(): workflow_mock = Mock(spec=workflow_config.WorkflowConfig) workflow_mock.name = "same_name" workflow_mock.config_path = "/duplicate/path" workflow_mock.function_dir = "func_dir" return workflow_mock config = workflow_config.WorkflowConfigs() # Create duplicate workflows workflows = [get_mock_config(), get_mock_config()] monkeypatch.setattr(config, "_workflows", workflows) with caplog.at_level(logging.INFO): config.get_workflows() assert "Duplicate workflow name: same_name, skipping func_dir" in caplog.text