ForcePilot/backend/test/integration/api/channels/conftest.py
Kris ff07cef881 test: 批量完善单元测试与集成测试用例
1. 为测试桩函数新增version、debug/exception日志等必要字段
2. 重构SQLAlchemy事务上下文测试,修复隐式事务提交逻辑
3. 修复微信WOC插件适配器测试用例,补充缺失的日志方法与测试场景
4. 调整路由阶段测试,移除过时的会话刷新逻辑
5. 新增内容审核 retention 定时任务测试用例
6. 完善配对、会话、账号模型测试用例
7. 删除过时的报表集成测试文件
8. 为持久化适配器添加配对状态更新的乐观锁测试
9. 修复配置验证测试的断言逻辑
2026-07-08 03:58:05 +08:00

37 lines
1.6 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_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"