mirror of
https://github.com/AstrBotDevs/AstrBot.git
synced 2026-08-31 01:40:25 +08:00
fix: handle DingTalk app creation status
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user