Release Access v0.1.20 configuration package context
Module Package Release / publish-packages (push) Successful in 11s
Module Package Release / publish-packages (push) Successful in 11s
This commit is contained in:
@@ -5,6 +5,10 @@ from types import SimpleNamespace
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
from govoplan_access.backend.api.v1.admin_schemas import (
|
||||
ConfigurationPackageApplyResponse,
|
||||
ConfigurationPackageExportResponse,
|
||||
)
|
||||
from govoplan_access.backend.api.v1.routes import _configuration_context
|
||||
from govoplan_core.core.infrastructure_capabilities import (
|
||||
InfrastructureCapabilityReceiptError,
|
||||
@@ -16,6 +20,39 @@ from govoplan_core.core.provider_governance import (
|
||||
|
||||
|
||||
class ConfigurationPackageContextTests(unittest.TestCase):
|
||||
def test_api_responses_preserve_rollback_and_redacted_export_provenance(self) -> None:
|
||||
applied = ConfigurationPackageApplyResponse(
|
||||
rollback={
|
||||
"status": "database_restore_required",
|
||||
"summary": "Snapshot is the generic rollback boundary.",
|
||||
"recovery_action": "Retain the snapshot.",
|
||||
}
|
||||
)
|
||||
exported = ConfigurationPackageExportResponse(
|
||||
provenance={
|
||||
"exported_at": "2026-08-22T12:00:00+00:00",
|
||||
"source_core_version": "0.1.35",
|
||||
"module_versions": {"forms": "0.1.20"},
|
||||
"tenant_id": "tenant-1",
|
||||
"exporter_id": "user-1",
|
||||
"selection": {
|
||||
"scopes": ["tenant"],
|
||||
"module_ids": ["forms"],
|
||||
"object_refs": [],
|
||||
},
|
||||
"redacted_secret_keys": ["credential_ref"],
|
||||
}
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
"database_restore_required",
|
||||
applied.model_dump()["rollback"]["status"],
|
||||
)
|
||||
self.assertEqual(
|
||||
["credential_ref"],
|
||||
exported.model_dump()["provenance"]["redacted_secret_keys"],
|
||||
)
|
||||
|
||||
def test_context_carries_operator_scopes_and_validated_infrastructure_receipt(self) -> None:
|
||||
receipt = SimpleNamespace(installation_id="deployment-1")
|
||||
principal = SimpleNamespace(
|
||||
|
||||
Reference in New Issue
Block a user