TBC/scripts/shared_data.py
D-Robotics cfb653c2d5 v1.0.0: Python 3.9 兼容性修复 + Dashboard E2E 入口 + 文档同步
- 15个文件添加 from __future__ import annotations 修复 Python 3.9 管道语法
- DCloudDashboard 首页新增总览分组,E2E 全量测试入口卡片
- 同步更新 README/history/测试用例文档
2026-06-25 19:32:09 +08:00

34 lines
1.1 KiB
Python
Raw Permalink 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.

"""测试数据预置 - 共享常量与工具函数
供 setup_test_data.py 和 setup_test_data_api.py 共用。
"""
from __future__ import annotations
import sys
import os
from pathlib import Path
# 确保项目根目录可导入(使 from tests.conftest_auth 生效)
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from tests.conftest_auth import _get_token_from_auth_state
AUTH_STATE_FILE = Path(__file__).parent.parent / ".auth" / "state.json"
# 预置测试文件
TEST_FILES = [
{"name": "test_file_1.txt", "content": "测试文件1 - 自动化测试数据"},
{"name": "test_file_2.txt", "content": "测试文件2 - 自动化测试数据"},
{"name": "test_file_3.txt", "content": "测试文件3 - 自动化测试数据"},
{"name": "test_image.jpg", "content": b"\xff\xd8\xff\xe0\x00\x10JFIF"},
]
# 预置测试文件夹
TEST_FOLDERS = ["test_folder_1", "test_folder_2"]
def get_token() -> str | None:
"""从认证状态文件获取 token(委托给 conftest_auth 的统一实现)。"""
return _get_token_from_auth_state()