Skip to content

Commit

Permalink
Work on workflow & flow names
Browse files Browse the repository at this point in the history
  • Loading branch information
ogenstad committed Oct 31, 2024
1 parent 2e89e34 commit 254d2d8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions backend/tests/unit/workflows/test_catalogue.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

from collections import Counter
from typing import TYPE_CHECKING

import pytest
Expand All @@ -14,3 +15,19 @@
def test_workflow_definition(workflow: WorkflowDefinition) -> None:
"""Validate that we can import the function for each workflow."""
workflow.validate_workflow()


@pytest.mark.parametrize("workflow", [pytest.param(workflow, id=workflow.name) for workflow in workflows])
def test_workflow_definition_matches(workflow: WorkflowDefinition) -> None:
"""Validate that the name of the workflow matches the name of the flow"""
flow = workflow.get_function()
assert hasattr(flow, "name")
assert workflow.name == flow.name


def test_workflow_definition_flow_names() -> None:
"""Validate that each workflow has a unique name defined"""
flow_names = [workflow.name for workflow in workflows]
name_counter = Counter(flow_names)
duplicates = [name for name, count in name_counter.items() if count > 1]
assert not duplicates, f"Duplicate flow names found: {', '.join(duplicates)}"

0 comments on commit 254d2d8

Please sign in to comment.