from __future__ import annotations import unittest from govoplan_core.core.encryption import ( CAPABILITY_ENCRYPTION_CONTENT_CIPHER, CAPABILITY_ENCRYPTION_CONTENT_CIPHER_PROVIDER_PREFIX, CAPABILITY_ENCRYPTION_CONTENT_PROTECTION, CAPABILITY_ENCRYPTION_DISABLE_PREFLIGHT, CAPABILITY_ENCRYPTION_KEY_MATERIAL_PROVIDER_PREFIX, CAPABILITY_ENCRYPTION_KEY_VAULT, CAPABILITY_ENCRYPTION_RECOVERY, ) from govoplan_encryption.backend.manifest import get_manifest from govoplan_encryption.backend.local_provider import LOCAL_PROVIDER_ID class EncryptionManifestTests(unittest.TestCase): def test_manifest_exposes_governed_capabilities_and_operator_ui(self) -> None: manifest = get_manifest() self.assertEqual("encryption", manifest.id) self.assertEqual((), manifest.dependencies) self.assertEqual( { CAPABILITY_ENCRYPTION_KEY_VAULT, CAPABILITY_ENCRYPTION_CONTENT_PROTECTION, CAPABILITY_ENCRYPTION_CONTENT_CIPHER, CAPABILITY_ENCRYPTION_RECOVERY, CAPABILITY_ENCRYPTION_DISABLE_PREFLIGHT, f"{CAPABILITY_ENCRYPTION_KEY_MATERIAL_PROVIDER_PREFIX}{LOCAL_PROVIDER_ID}", f"{CAPABILITY_ENCRYPTION_CONTENT_CIPHER_PROVIDER_PREFIX}{LOCAL_PROVIDER_ID}", }, set(manifest.capability_factories), ) self.assertIsNotNone(manifest.route_factory) self.assertIsNotNone(manifest.migration_spec) self.assertIsNotNone(manifest.frontend) self.assertEqual("@govoplan/encryption-webui", manifest.frontend.package_name) self.assertEqual( { "encryption.admin.operations", "encryption.admin.vaults", "encryption.admin.migrations", "encryption.admin.recovery", }, {surface.id for surface in manifest.frontend.view_surfaces}, ) self.assertIn( "encryption.administration", {topic.id for topic in manifest.documentation}, ) self.assertEqual("vertical_slice", manifest.architecture.maturity) if __name__ == "__main__": unittest.main()