test(gateway): declare routed profile as served in reaction observer test

Main now fail-closes profile routes targeting unserved profiles
(_profile_name_for_source checks _multiplex_profile_homes). The
provenance test routes to profile 'work', which no longer stamps in a
bare test env; mock the served-profile set so the route resolves.
This commit is contained in:
Teknium
2026-08-12 16:38:29 -07:00
parent 1e46e09bbd
commit e4f4805108
@@ -447,9 +447,16 @@ class TestProfileScopedPlatformEventHandler:
adapter = _adapter()
adapter.gateway_runner = runner # type: ignore[assignment]
source = adapter._source_from_reaction_for_auth(
_auth_reaction_update(user_id=777)
)
# Main now rejects routes to unserved profiles (_profile_name_for_source
# checks _multiplex_profile_homes); declare "work" as served so the
# route stamps rather than fail-closing to profile=None.
with patch(
"gateway.run._multiplex_profile_homes",
return_value=[("work", Path("/profiles/work"))],
):
source = adapter._source_from_reaction_for_auth(
_auth_reaction_update(user_id=777)
)
assert source.profile == "work"
assert getattr(source, "_transport_adapter_ref")() is adapter