test: 更新 AgentScope 相关单元测试与集成测试

- 重命名 test_react_runner.py 为 test_runner.py
- 新增 test_utils.py 测试工具函数
- 更新现有测试用例适配新架构
This commit is contained in:
qzl
2026-03-16 16:11:06 +08:00
parent 36b104fa37
commit e55f12cdc1
15 changed files with 753 additions and 717 deletions
@@ -340,3 +340,31 @@ class TestSupabaseAuthGateway:
assert exc_info.value.status_code == 503
assert exc_info.value.detail == "Auth service temporarily unavailable"
@pytest.mark.asyncio
async def test_get_user_by_email_uses_in_memory_cache(
self,
gateway: tuple[SupabaseAuthGateway, MagicMock, MagicMock],
monkeypatch: pytest.MonkeyPatch,
) -> None:
sut, _, _ = gateway
user = SimpleNamespace(
id="user-1",
email="cached@example.com",
created_at="2026-03-16T00:00:00Z",
email_confirmed_at=None,
)
list_calls = {"count": 0}
def _fake_list_auth_users(_client: object) -> list[SimpleNamespace]:
list_calls["count"] += 1
return [user]
monkeypatch.setattr("v1.auth.gateway._list_auth_users", _fake_list_auth_users)
first = await sut.get_user_by_email("cached@example.com")
second = await sut.get_user_by_email("CACHED@example.com")
assert first.id == "user-1"
assert second.email == "cached@example.com"
assert list_calls["count"] == 1