from __future__ import annotations import unittest from govoplan_core.core.tickets import ( CAPABILITY_TICKET_CASE_ESCALATION, CAPABILITY_TICKET_ROUTING, ) from govoplan_tickets.backend.dsar_provider import TICKETS_DSAR_CAPABILITY from govoplan_tickets.backend.manifest import ( ADMIN_SCOPE, ASSIGN_SCOPE, READ_SCOPE, REPORT_SCOPE, RESOLVE_SCOPE, TRIAGE_SCOPE, WRITE_SCOPE, get_manifest, ) from govoplan_tickets.backend.service import CAPABILITY_TICKETS_REGISTRY class ManifestTests(unittest.TestCase): def test_manifest_registers_the_vertical_slice(self) -> None: manifest = get_manifest() self.assertEqual("tickets", manifest.id) self.assertEqual("0.1.22", manifest.version) self.assertEqual(("access",), manifest.dependencies) self.assertEqual( { READ_SCOPE, REPORT_SCOPE, TRIAGE_SCOPE, ASSIGN_SCOPE, RESOLVE_SCOPE, ADMIN_SCOPE, WRITE_SCOPE, }, {permission.scope for permission in manifest.permissions}, ) self.assertEqual( { "tickets_reporter", "tickets_manager", "tickets_viewer", "tickets_administrator", }, {role.slug for role in manifest.role_templates}, ) self.assertIsNotNone(manifest.route_factory) self.assertIsNotNone(manifest.migration_spec) self.assertIsNotNone(manifest.frontend) self.assertEqual(1, len(manifest.search_sources)) self.assertIn(CAPABILITY_TICKETS_REGISTRY, manifest.capability_factories) self.assertIn(TICKETS_DSAR_CAPABILITY, manifest.capability_factories) self.assertEqual( {CAPABILITY_TICKET_ROUTING, CAPABILITY_TICKET_CASE_ESCALATION}, set(manifest.optional_capabilities), ) self.assertEqual("vertical_slice", manifest.architecture.maturity) def test_documentation_has_static_and_workflow_baselines_in_german(self) -> None: topics = get_manifest().documentation self.assertTrue(any(topic.layer == "available" for topic in topics)) self.assertTrue(any(topic.metadata.get("kind") == "workflow" for topic in topics)) for topic in topics: self.assertTrue( all(topic.translations.get("de", {}).get(field) for field in ("title", "summary", "body")), topic.id, ) optional = next(topic for topic in topics if topic.id == "tickets.optional-integrations") self.assertIn("Helpdesk", optional.body) self.assertIn("Search", optional.body) if __name__ == "__main__": unittest.main()