mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-01 01:10:21 +08:00
* feat(lark): implement app registration and bot info retrieval - Add app registration functionality for Lark and Feishu platforms, including endpoints and request handling. - Introduce polling mechanism for app registration status. - Create bot info retrieval functionality to fetch bot details after successful registration. - Enhance dashboard with new UI components for one-click QR setup and manual setup options. - Update internationalization files to support new features and actions. - Add unit tests for app registration endpoint resolution and data handling. * feat(weixin_oc): add WeChat login registration and QR code handling
33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
from astrbot.core.platform.sources.lark.app_registration import (
|
|
DEFAULT_FEISHU_OPEN_DOMAIN,
|
|
DEFAULT_LARK_OPEN_DOMAIN,
|
|
_registration_data,
|
|
resolve_app_registration_endpoints,
|
|
)
|
|
|
|
|
|
def test_resolve_app_registration_endpoints_uses_feishu_accounts_domain():
|
|
endpoints = resolve_app_registration_endpoints(DEFAULT_FEISHU_OPEN_DOMAIN)
|
|
|
|
assert endpoints.open_base == DEFAULT_FEISHU_OPEN_DOMAIN
|
|
assert endpoints.registration == (
|
|
"https://accounts.feishu.cn/oauth/v1/app/registration"
|
|
)
|
|
|
|
|
|
def test_resolve_app_registration_endpoints_uses_lark_accounts_domain():
|
|
endpoints = resolve_app_registration_endpoints(DEFAULT_LARK_OPEN_DOMAIN)
|
|
|
|
assert endpoints.open_base == DEFAULT_LARK_OPEN_DOMAIN
|
|
assert endpoints.registration == (
|
|
"https://accounts.larksuite.com/oauth/v1/app/registration"
|
|
)
|
|
|
|
|
|
def test_registration_data_accepts_wrapped_and_plain_payloads():
|
|
wrapped = {"data": {"device_code": "device"}}
|
|
plain = {"device_code": "device"}
|
|
|
|
assert _registration_data(wrapped) == {"device_code": "device"}
|
|
assert _registration_data(plain) == {"device_code": "device"}
|