ForcePilot/backend/test/integration/api/channels/conftest.py
Kris 04a2472014 test(channel): add full integration test suite for channels module
1. 新增channels模块集成测试目录与基础fixture
2. 为capability、doctor、reports、dashboard、directory、webhook、wizard、health、analytics、allowlist、config等路由编写完整的鉴权、参数校验与异常场景测试
3. 修复基础集成测试setup,新增external/scheduler/channel数据库schema初始化步骤
2026-07-02 03:25:27 +08:00

39 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""channels 模块集成测试共享 fixture 与常量。
父级 ``backend/test/integration/conftest.py`` 已提供 ``test_client``、
``admin_headers``、``standard_user``,本文件仅补充 channels 资源域所需的
路径常量、默认值与 payload 构造辅助函数。
由于真实渠道账户依赖外部 IM 平台凭据(飞书/钉钉等),测试环境通常无法
创建可用账户,因此业务路径测试统一使用 ``NON_EXISTENT_*`` 占位 ID断言
404 / 501 / 422 等错误路径;列表类端点断言 200 与响应结构。
"""
from __future__ import annotations
# channels 路由统一挂载在 /api/channels 下
BASE_URL = "/api/channels"
# 默认渠道类型(飞书),用于路径参数;不依赖真实适配器
DEFAULT_CHANNEL_TYPE = "feishu"
# 不存在的资源 ID用于 404 / 状态机错误路径测试
NON_EXISTENT_ACCOUNT_ID = "nonexistent_account_00000000"
NON_EXISTENT_SESSION_ID = "nonexistent_session_00000000"
NON_EXISTENT_MESSAGE_ID = "nonexistent_message_00000000"
NON_EXISTENT_OUTBOX_ID = "nonexistent_outbox_00000000"
NON_EXISTENT_PAIRING_ID = "nonexistent_pairing_00000000"
NON_EXISTENT_PEER_ID = "nonexistent_peer_00000000"
NON_EXISTENT_GROUP_ID = "nonexistent_group_00000000"
NON_EXISTENT_PLUGIN_ID = "nonexistent_plugin_00000000"
NON_EXISTENT_CONFIG_KEY = "nonexistent_config_key_0000"
NON_EXISTENT_LOG_ID = "nonexistent_log_00000000"
NON_EXISTENT_TASK_ID = "nonexistent_task_00000000"
NON_EXISTENT_REPORT_ID = "nonexistent_report_00000000"
NON_EXISTENT_CHECK_ID = "nonexistent_check_00000000"
NON_EXISTENT_REVIEW_ID = "nonexistent_review_00000000"
# ISO 8601 时间字符串(用于 analytics / dashboard / audit 查询参数)
ISO_TIME_START = "2026-01-01T00:00:00Z"
ISO_TIME_END = "2026-07-01T00:00:00Z"