Files
govoplan-workflow/tests/test_manifest.py

44 lines
1.2 KiB
Python

from __future__ import annotations
import unittest
from govoplan_workflow.backend.manifest import (
DEFINITION_READ_SCOPE,
DEFINITION_WRITE_SCOPE,
get_manifest,
)
class WorkflowManifestTests(unittest.TestCase):
def test_manifest_exposes_definition_contracts(self) -> None:
manifest = get_manifest()
self.assertEqual(manifest.id, "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.assertEqual(
"@govoplan/workflow-webui",
manifest.frontend.package_name if manifest.frontend else None,
)
self.assertIsNotNone(manifest.migration_spec)
requirement = next(
item
for item in manifest.requires_interfaces
if item.name == "dataflow.run_lifecycle"
)
self.assertTrue(requirement.optional)
if __name__ == "__main__":
unittest.main()