fix: handle DingTalk app creation status

This commit is contained in:
Soulter
2026-08-26 00:38:45 +08:00
parent 19d00fb1f0
commit c99580e6bb
2 changed files with 5 additions and 2 deletions
@@ -121,7 +121,7 @@ async def poll_dingtalk_app_registration_once(device_code: str) -> dict[str, Any
def dingtalk_registration_poll_result(raw: dict[str, Any]) -> dict[str, Any]:
status_raw = _string_field(raw, "status").upper()
if status_raw == "WAITING":
if status_raw in {"WAITING", "CREATING"}:
return {"status": "pending"}
if status_raw == "SUCCESS":
client_id = _string_field(raw, "client_id")
+4 -1
View File
@@ -15,10 +15,13 @@ def test_dingtalk_registration_defaults(monkeypatch):
assert dingtalk_registration_source() == DEFAULT_DINGTALK_REGISTRATION_SOURCE
def test_dingtalk_registration_poll_result_maps_waiting_and_success():
def test_dingtalk_registration_poll_result_maps_pending_states_and_success():
assert dingtalk_registration_poll_result({"status": "WAITING"}) == {
"status": "pending"
}
assert dingtalk_registration_poll_result({"status": "CREATING"}) == {
"status": "pending"
}
assert dingtalk_registration_poll_result(
{