Files
govoplan-scheduling/tests/test_manifest.py
T
zemion 129f2a4c73 fix(ui): move widget and page documentation into 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:04:19 +02:00

133 lines
5.3 KiB
Python

from __future__ import annotations
import unittest
from pathlib import Path
from govoplan_core.core.modules import ModuleManifest
from govoplan_scheduling.backend.manifest import get_manifest
class SchedulingManifestTests(unittest.TestCase):
def test_widget_documentation_is_contributed_for_its_dashboard_title(self) -> None:
root = Path(__file__).resolve().parents[1]
contribution = (root / "webui/src/module.ts").read_text(encoding="utf-8")
widget = (root / "webui/src/features/scheduling/SchedulingRequestsWidget.tsx").read_text(encoding="utf-8")
self.assertIn(
'documentation: { topicId: "scheduling.find-and-decide-meeting-time", documentationType: "user" }',
contribution,
)
self.assertNotIn("DocumentationHelpLink", widget)
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
)
def test_manifest_contract(self) -> None:
manifest = get_manifest()
self.assertIsInstance(manifest, ModuleManifest)
self.assertEqual(manifest.id, "scheduling")
self.assertIn("poll", manifest.dependencies)
self.assertNotIn("access", manifest.dependencies)
self.assertIn("access", manifest.optional_dependencies)
self.assertIn("addresses", manifest.optional_dependencies)
self.assertIn("policy", manifest.optional_dependencies)
self.assertEqual(
("poll.scheduling", "poll.participation_gateway"),
manifest.required_capabilities,
)
self.assertIn("auth.principalResolver", manifest.optional_capabilities)
self.assertIn("poll.scheduling", manifest.required_capabilities)
self.assertIn("calendar.scheduling", manifest.optional_capabilities)
self.assertIn(
"policy.schedulingParticipantPrivacy", manifest.optional_capabilities
)
self.assertIn("access.people_search", manifest.optional_capabilities)
self.assertIn("addresses.people_search", manifest.optional_capabilities)
self.assertIn("evaluation", manifest.optional_dependencies)
self.assertIsNotNone(manifest.route_factory)
self.assertIsNotNone(manifest.public_tenant_resolver)
self.assertIsNotNone(manifest.migration_spec)
self.assertIsNotNone(manifest.frontend)
self.assertEqual(
[
"/scheduling/public/:requestId/:token",
"/scheduling/enrol/:requestId/:token",
],
[route.path for route in manifest.frontend.public_routes],
)
self.assertIn(
"poll.availability_matrix",
{interface.name for interface in manifest.requires_interfaces},
)
self.assertIn(
"poll.response_collection",
{interface.name for interface in manifest.requires_interfaces},
)
self.assertIn(
"poll.workflow_context",
{interface.name for interface in manifest.requires_interfaces},
)
self.assertIn(
"poll.governed_participation",
{interface.name for interface in manifest.requires_interfaces},
)
self.assertIn(
"notifications.dispatch",
{interface.name for interface in manifest.requires_interfaces},
)
self.assertIn(
"access.people_search",
{interface.name for interface in manifest.requires_interfaces},
)
self.assertIn(
"addresses.people_search",
{interface.name for interface in manifest.requires_interfaces},
)
self.assertIn(
"calendar.scheduling",
{interface.name for interface in manifest.requires_interfaces},
)
required_interfaces = {
interface.name: interface for interface in manifest.requires_interfaces
}
for interface_name in (
"poll.availability_matrix",
"poll.response_collection",
"poll.workflow_context",
"poll.governed_participation",
):
self.assertEqual("0.1.11", required_interfaces[interface_name].version_min)
documentation = {topic.id: topic for topic in manifest.documentation}
workflow = documentation["scheduling.find-and-decide-meeting-time"]
self.assertEqual("workflow", workflow.metadata["kind"])
self.assertEqual("/scheduling", workflow.metadata["route"])
self.assertIn("scheduling.request", workflow.metadata["help_contexts"])
self.assertIn(
"scheduling.public-participation", workflow.metadata["help_contexts"]
)
self.assertIn(
"scheduling.calendar-coordination",
documentation["scheduling.calendar-coordination"].metadata["help_contexts"],
)
self.assertIn(
"scheduling.public-self-enrollment",
documentation["scheduling.public-self-enrollment"].metadata[
"help_contexts"
],
)
if __name__ == "__main__":
unittest.main()