84 lines
2.7 KiB
Python
84 lines
2.7 KiB
Python
from __future__ import annotations
|
|
|
|
import unittest
|
|
|
|
from govoplan_workflow_engine.backend.manifest import (
|
|
DEFINITION_READ_SCOPE,
|
|
DEFINITION_WRITE_SCOPE,
|
|
INSTANCE_START_SCOPE,
|
|
get_manifest,
|
|
)
|
|
from govoplan_workflow_engine.backend.service_launcher import (
|
|
CAPABILITY_WORKFLOW_SERVICE_LAUNCHER,
|
|
)
|
|
from govoplan_core.core.workflows import (
|
|
CAPABILITY_WORKFLOW_RUNTIME_WORKER,
|
|
)
|
|
|
|
|
|
class WorkflowManifestTests(unittest.TestCase):
|
|
def test_all_static_topics_have_complete_german_content(self) -> None:
|
|
manifest = get_manifest()
|
|
for topic in manifest.documentation:
|
|
german = (topic.translations or {}).get("de", {})
|
|
self.assertEqual({"title", "summary", "body"}, set(german), topic.id)
|
|
self.assertTrue(
|
|
all(str(value).strip() for value in german.values()), topic.id
|
|
)
|
|
|
|
recovery = next(
|
|
topic
|
|
for topic in manifest.documentation
|
|
if topic.id == "workflow.runtime-recovery"
|
|
)
|
|
self.assertEqual("reference", recovery.metadata["kind"])
|
|
self.assertTrue(recovery.metadata["consequence_classes"])
|
|
|
|
def test_manifest_exposes_definition_contracts(self) -> None:
|
|
manifest = get_manifest()
|
|
|
|
self.assertEqual(manifest.id, "workflow_engine")
|
|
self.assertEqual(manifest.permission_namespace, "workflow")
|
|
self.assertIn(
|
|
"workflow.definition_graph",
|
|
{item.name for item in manifest.provides_interfaces},
|
|
)
|
|
self.assertIn(
|
|
DEFINITION_READ_SCOPE,
|
|
{item.scope for item in manifest.permissions},
|
|
)
|
|
self.assertIn(
|
|
DEFINITION_WRITE_SCOPE,
|
|
{item.scope for item in manifest.permissions},
|
|
)
|
|
self.assertIn(
|
|
INSTANCE_START_SCOPE,
|
|
{item.scope for item in manifest.permissions},
|
|
)
|
|
self.assertIn(
|
|
"workflow.runtime_worker",
|
|
{item.name for item in manifest.provides_interfaces},
|
|
)
|
|
self.assertIn(
|
|
CAPABILITY_WORKFLOW_RUNTIME_WORKER,
|
|
manifest.capability_factories,
|
|
)
|
|
self.assertIn(
|
|
CAPABILITY_WORKFLOW_SERVICE_LAUNCHER,
|
|
manifest.capability_factories,
|
|
)
|
|
self.assertIsNone(manifest.frontend)
|
|
self.assertEqual((), manifest.nav_items)
|
|
self.assertIsNotNone(manifest.migration_spec)
|
|
self.assertEqual("workflow_engine", manifest.migration_spec.module_id)
|
|
requirement = next(
|
|
item
|
|
for item in manifest.requires_interfaces
|
|
if item.name == "dataflow.run_lifecycle"
|
|
)
|
|
self.assertTrue(requirement.optional)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|