tenant-engine/tests
tegwick 31e237cfa6 Fix: resolve tenants by identifier, not only internal tenant_id
Found via a real cross-service check while implementing key-cape's
KEY-WP-0005-T02: key-cape's Go adapter called GET /tenants/tenant:coulomb/roles
and got a genuine 404 for a tenant that existed. External callers
(key-cape, flex-auth) only ever have a tenant's profile identifier, never
tenant-engine's internal tenant_id (caller-chosen at creation, otherwise
opaque). Every existing test happened to use identical strings for both
fields, so this was invisible until a real, independent second caller
exercised the documented contract.

InMemoryTenantStore gained a _by_identifier index and a _resolve() helper
every method calls first; create_tenant now also rejects a duplicate
identifier under a different internal id (an oversight the same fix
surfaced). 5 new tests, including the exact HTTP-level scenario with colon
characters in the URL path. 65 total, all 60 pre-existing tests unaffected.

Re-verified end-to-end for real: fresh flex-auth + tenant-engine + key-cape's
actual adapter code, over real HTTP -- roles=[IAM] ok=true resolving by
identifier.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-24 00:15:26 +02:00
..
test_api_reads.py Fix: resolve tenants by identifier, not only internal tenant_id 2026-07-24 00:15:26 +02:00
test_api_writes.py TEN-WP-0002 T04-T07: cache-read, live-lookup (fail-closed), write API, close 2026-07-23 22:24:09 +02:00
test_app.py TEN-WP-0002 T01-T03: service skeleton, domain model, storage layer 2026-07-23 22:01:23 +02:00
test_authz_flex.py TEN-WP-0003: FlexAuthWriteAuthorizer -- gate writes through flex-auth 2026-07-23 22:54:44 +02:00
test_domain.py TEN-WP-0002 T01-T03: service skeleton, domain model, storage layer 2026-07-23 22:01:23 +02:00
test_flex_auth.py TEN-WP-0003: FlexAuthWriteAuthorizer -- gate writes through flex-auth 2026-07-23 22:54:44 +02:00
test_store.py Fix: resolve tenants by identifier, not only internal tenant_id 2026-07-24 00:15:26 +02:00