fix: preserve tenant creation metadata and report authority denial
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Container Image / build-and-push (push) Successful in 35s

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a07ff8-19d0-7820-b4d0-1353833cb7fc
This commit is contained in:
tegwick 2026-09-11 20:52:47 +02:00
parent b9ae48b00c
commit 3c85e563ee
3 changed files with 50 additions and 2 deletions

View file

@ -63,11 +63,22 @@ class TenantManagementAdapterTests(unittest.TestCase):
"tenant_id": "tenant:friendly:new",
"identifier": "tenant:friendly:new",
"actor": "user-engine",
"display_name": "New",
"correlation_id": "corr-1",
})
self.assertEqual(result.status, "created")
self.assertEqual(result.external_ref, "tenant:friendly:new")
def test_create_denial_is_not_reported_as_provisioning_outage(self):
adapter = HTTPTenantManagementAdapter(base_url="http://tenant-engine", bearer_token="synthetic")
error = _http_error(403, {"error_code": "write_denied", "detail": "private policy detail"})
with patch("user_engine.adapters.tenant_management.urlopen", side_effect=error):
with self.assertRaises(AuthorizationDenied) as caught:
adapter.create_tenant(tenant="tenant:trial:demo-company", display_name="Demo",
idempotency_key="demo-create", correlation_id="corr-demo")
self.assertNotIn("private policy", str(caught.exception))
class TenantLifecycleAdapterTests(unittest.TestCase):
def setUp(self):
self.adapter = HTTPTenantManagementAdapter(