diff --git a/tests/test_feishu_api_services.py b/tests/test_feishu_api_services.py index b03ce8c..355558a 100644 --- a/tests/test_feishu_api_services.py +++ b/tests/test_feishu_api_services.py @@ -173,8 +173,6 @@ def test_send_personal_message_api_error(monkeypatch, settings): def test_send_personal_message_refreshes_token_once(monkeypatch, settings): settings.FEISHU_MESSAGE_API_URL = "http://feishu/messages" - settings.FEISHU_APP_ID = "cli_a" - settings.FEISHU_APP_SECRET = "secret" calls = {"message": 0} def fake_message_post(*args, **kwargs): @@ -185,8 +183,12 @@ def test_send_personal_message_refreshes_token_once(monkeypatch, settings): monkeypatch.setattr("review_agent.notifications.feishu_message_api.httpx.post", fake_message_post) monkeypatch.setattr( - "review_agent.notifications.feishu_token.httpx.post", - lambda *args, **kwargs: FakeResponse({"code": 0, "tenant_access_token": "fresh", "expire": 7200}), + "review_agent.notifications.feishu_message_api.get_tenant_access_token", + lambda force_refresh=False: type( + "TokenResult", + (), + {"ok": True, "tenant_access_token": "fresh", "error_code": "", "error_message": ""}, + )(), ) result = send_personal_message(