from __future__ import annotations import unittest from govoplan_organizations.backend.manifest import manifest class OrganizationsInterfaceDocumentationContractTests(unittest.TestCase): def test_route_and_admin_surface_remain_declared(self) -> None: frontend = manifest.frontend self.assertIsNotNone(frontend) self.assertEqual( {"/organizations"}, {route.path for route in frontend.routes}, # type: ignore[union-attr] ) self.assertEqual( {"organizations.admin.tenant"}, {surface.id for surface in frontend.view_surfaces}, # type: ignore[union-attr] ) self.assertTrue( all(item.icon == "building-2" for item in manifest.nav_items) ) def test_topics_publish_stable_help_and_consequence_metadata(self) -> None: topics = {topic.id: topic for topic in manifest.documentation} self.assertIn("organizations.model", topics) self.assertIn("organizations.reference.fields-and-consequences", topics) self.assertIn( "organizations.admin.tenant", topics["organizations.model"].metadata["help_contexts"], ) reference = topics["organizations.reference.fields-and-consequences"] self.assertIn( "organizations.field.change-request", reference.metadata["help_contexts"], ) self.assertIn("hierarchy_change", reference.metadata["consequence_classes"]) if __name__ == "__main__": unittest.main()