workflows.tests.test_modelsΒΆ

Tests for workflows models module.

ClassesΒΆ

TestState

Test the State enum.

TestBadgeMap

Test the BADGE_MAP dictionary.

TestGetStatusBadge

Test the get_status_badge function.

TestWorkflowDefinition

Test the WorkflowDefinition model.

TestWorkflowScope

Test the WorkflowScope model.

Module ContentsΒΆ

class workflows.tests.test_models.TestState[source]ΒΆ

Test the State enum.

test_state_has_all_expected_values()[source]ΒΆ

Test that State enum has all expected values.

test_state_values()[source]ΒΆ

Test that State enum values are correct.

test_state_is_text_choices()[source]ΒΆ

Test that State is a TextChoices subclass.

class workflows.tests.test_models.TestBadgeMap[source]ΒΆ

Test the BADGE_MAP dictionary.

test_badge_map_has_all_states()[source]ΒΆ

Test that BADGE_MAP contains all State enum values.

test_badge_map_structure()[source]ΒΆ

Test that each badge entry is a tuple of (label, css_class).

test_badge_map_css_classes()[source]ΒΆ

Test that badge CSS classes start with β€˜bg-β€˜.

test_specific_badge_values()[source]ΒΆ

Test specific badge values for key states.

class workflows.tests.test_models.TestGetStatusBadge[source]ΒΆ

Test the get_status_badge function.

test_with_none()[source]ΒΆ

Test get_status_badge with None returns unknown badge.

test_with_state_enum()[source]ΒΆ

Test get_status_badge with State enum member.

test_with_state_string()[source]ΒΆ

Test get_status_badge with state string.

test_with_awaiting_state()[source]ΒΆ

Test get_status_badge with awaiting state.

test_with_approved_state()[source]ΒΆ

Test get_status_badge with approved state.

test_with_rejected_state()[source]ΒΆ

Test get_status_badge with rejected state.

test_with_failed_state()[source]ΒΆ

Test get_status_badge with failed state.

test_with_aborted_state()[source]ΒΆ

Test get_status_badge with aborted state.

test_with_passed_state()[source]ΒΆ

Test get_status_badge with passed state.

test_with_finalized_state()[source]ΒΆ

Test get_status_badge with finalized state.

test_with_normalized_string()[source]ΒΆ

Test get_status_badge with normalized string (case insensitive).

test_with_whitespace_string()[source]ΒΆ

Test get_status_badge with whitespace in string.

test_with_unknown_string()[source]ΒΆ

Test get_status_badge with unknown string returns fallback.

class workflows.tests.test_models.TestWorkflowDefinition[source]ΒΆ

Test the WorkflowDefinition model.

test_create_workflow_definition()[source]ΒΆ

Test creating a workflow definition.

test_workflow_definition_str()[source]ΒΆ

Test string representation of workflow definition.

test_workflow_definition_default_version()[source]ΒΆ

Test that version defaults to 1.

test_workflow_definition_default_published()[source]ΒΆ

Test that published defaults to False.

test_workflow_definition_auto_timestamps()[source]ΒΆ

Test that timestamps are automatically set.

test_workflow_definition_unique_name()[source]ΒΆ

Test that workflow names must be unique.

test_workflow_definition_ordering()[source]ΒΆ

Test that workflows are ordered by created_at descending.

test_workflow_definition_with_complex_definition()[source]ΒΆ

Test workflow with complex definition JSON.

class workflows.tests.test_models.TestWorkflowScope[source]ΒΆ

Test the WorkflowScope model.

test_create_workflow_scope()[source]ΒΆ

Test creating a workflow scope.

test_workflow_scope_with_null_values()[source]ΒΆ

Test creating scope with NULL values (meaning any).

test_workflow_scope_cascade_delete()[source]ΒΆ

Test that scope is deleted when workflow is deleted.

Test accessing scopes through workflow’s related name.

test_workflow_scope_with_only_ca()[source]ΒΆ

Test scope with only CA specified.

test_workflow_scope_with_only_domain()[source]ΒΆ

Test scope with only domain specified.

test_workflow_scope_with_only_device()[source]ΒΆ

Test scope with only device specified.

test_multiple_scopes_for_workflow()[source]ΒΆ

Test that a workflow can have multiple scopes.

test_workflow_scope_str_with_ca()[source]ΒΆ

Test string representation with CA only.

test_workflow_scope_str_with_domain()[source]ΒΆ

Test string representation with domain only.

test_workflow_scope_str_with_device()[source]ΒΆ

Test string representation with device only.

test_workflow_scope_str_with_all()[source]ΒΆ

Test string representation with all IDs.

test_workflow_scope_str_with_none()[source]ΒΆ

Test string representation with no IDs (any).

test_workflow_scope_unique_together()[source]ΒΆ

Test that unique_together constraint works.