fix: handle feishu login network errors
maintainer edit: keep QR login network failures on the expected failure path instead of crashing the channels login command.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
|
||||
import httpx
|
||||
import pytest
|
||||
|
||||
from nanobot.channels import feishu as feishu_module
|
||||
@@ -46,6 +47,15 @@ def test_begin_registration_requires_login_url(monkeypatch):
|
||||
feishu_module._begin_registration()
|
||||
|
||||
|
||||
def test_qr_register_returns_none_on_network_error(monkeypatch):
|
||||
def raise_connect_error(_base_url, _body):
|
||||
raise httpx.ConnectError("network down")
|
||||
|
||||
monkeypatch.setattr(feishu_module, "_post_registration", raise_connect_error)
|
||||
|
||||
assert feishu_module.qr_register() is None
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_feishu_login_creates_missing_active_config(monkeypatch, tmp_path):
|
||||
missing_config = tmp_path / "missing.json"
|
||||
|
||||
Reference in New Issue
Block a user