Files
govoplan-dist-lists/tests/test_interface_documentation_contract.py
T
zemion 31e3899490 fix(ui): align contextual documentation with headings
Verified with the coordinated workspace changes by devkit full run
2026-09-08T225814-186389-0000-3e3ed7cd (all seven phases passed).
This shared UI pass does not mark the individual module reviews complete.
2026-09-09 02:03:40 +02:00

71 lines
2.7 KiB
Python

from __future__ import annotations
import unittest
from govoplan_core.core.modules import (
documentation_structured_translation_issues,
localizable_documentation_metadata_keys,
)
from govoplan_dist_lists.backend.manifest import manifest
class DistributionListsInterfaceDocumentationContractTests(unittest.TestCase):
def test_route_and_surfaces_remain_declared(self) -> None:
frontend = manifest.frontend
self.assertIsNotNone(frontend)
self.assertEqual(
{"/distribution-lists"},
{item.path for item in frontend.routes}, # type: ignore[union-attr]
)
self.assertEqual(
{
"dist_lists.page",
"dist_lists.editor",
"dist_lists.preview",
"dist_lists.picker",
},
{item.id for item in frontend.view_surfaces}, # type: ignore[union-attr]
)
def test_help_and_consequence_metadata_remain_published(self) -> None:
topics = {topic.id: topic for topic in manifest.documentation}
boundary = topics["dist_lists.boundary"]
reference = topics["dist_lists.reference.fields-and-consequences"]
self.assertIn("dist_lists.editor", boundary.metadata["help_contexts"])
self.assertIn(
"dist_lists.field.entry-mode",
reference.metadata["help_contexts"],
)
self.assertIn(
"freeze_snapshot",
reference.metadata["consequence_classes"],
)
self.assertIn(
"delete_definition",
reference.metadata["consequence_classes"],
)
def test_german_reference_documentation_is_complete(self) -> None:
topics = manifest.documentation
self.assertEqual(6, len(topics))
for topic in topics:
translation = topic.translations.get("de", {})
self.assertTrue(translation.get("title"), topic.id)
self.assertTrue(translation.get("summary"), topic.id)
self.assertTrue(translation.get("body"), topic.id)
if localizable_documentation_metadata_keys(topic):
self.assertEqual("1", topic.structured_translation_version, topic.id)
self.assertIn("de", topic.structured_translations, topic.id)
self.assertEqual((), documentation_structured_translation_issues(topic))
kinds = {topic.metadata.get("kind") for topic in topics}
self.assertIn("workflow", kinds)
self.assertIn("reference", kinds)
workflow = next(topic for topic in topics if topic.metadata.get("kind") == "workflow")
self.assertTrue(workflow.conditions)
if __name__ == "__main__":
unittest.main()