refactor: restructure project to modern Python layout, separate src, tests, docs, examples
This commit is contained in:
5
tests/__init__.py
Normal file
5
tests/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
"""
|
||||
测试包
|
||||
|
||||
包含单元测试、集成测试和测试工具。
|
||||
"""
|
||||
5
tests/fixtures/__init__.py
vendored
Normal file
5
tests/fixtures/__init__.py
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"""
|
||||
测试工具
|
||||
|
||||
包含测试数据、模拟环境和测试工具。
|
||||
"""
|
||||
97
tests/fixtures/test_configs.py
vendored
Normal file
97
tests/fixtures/test_configs.py
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import os
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'src'))
|
||||
|
||||
from config_man.utils.crypto import encrypt
|
||||
|
||||
|
||||
def create_test_configs():
|
||||
"""创建测试配置文件"""
|
||||
|
||||
# 测试配置数据
|
||||
test_configs = {
|
||||
"0.29": {
|
||||
"android": {
|
||||
"EventApiURL": "https://n3backend.azurewebsites.net/",
|
||||
"Ver": "0.29.1abc123",
|
||||
"PlayFabTitle": "B066F",
|
||||
"Google_Play_URL": "https://play.google.com/store/apps/details?id=com.arkgame.ft",
|
||||
"APP_Store_URL": "https://apps.apple.com/us/app/id6505145935",
|
||||
"HeartBeat": "60",
|
||||
"RTMPid": "80000586",
|
||||
"RTMServerEndpoint": "rtm-intl-frontgate.ilivedata.com:13321",
|
||||
"RTMHmacSecret": "57047697437f4f2c97a835e8d9a53358",
|
||||
"FuncUrl": "https://leaderboardcreate.azurewebsites.net",
|
||||
"FuncKey": "R5kU45fNBRd52Eqp3tEqfpZqrbFw53uSSEo7wraUSqIfAzFuRmLm_w=="
|
||||
},
|
||||
"ios": {
|
||||
"EventApiURL": "https://n3backend.azurewebsites.net/",
|
||||
"Ver": "0.29.1def456",
|
||||
"PlayFabTitle": "B066F",
|
||||
"Google_Play_URL": "https://play.google.com/store/apps/details?id=com.arkgame.ft",
|
||||
"APP_Store_URL": "https://apps.apple.com/us/app/id6505145935",
|
||||
"HeartBeat": "60",
|
||||
"RTMPid": "80000586",
|
||||
"RTMServerEndpoint": "rtm-intl-frontgate.ilivedata.com:13321",
|
||||
"RTMHmacSecret": "57047697437f4f2c97a835e8d9a53358",
|
||||
"FuncUrl": "https://leaderboardcreate.azurewebsites.net",
|
||||
"FuncKey": "R5kU45fNBRd52Eqp3tEqfpZqrbFw53uSSEo7wraUSqIfAzFuRmLm_w=="
|
||||
}
|
||||
},
|
||||
"0.30": {
|
||||
"android": {
|
||||
"EventApiURL": "https://n3backend.azurewebsites.net/",
|
||||
"Ver": "0.30.2ghi789",
|
||||
"PlayFabTitle": "B066F",
|
||||
"Google_Play_URL": "https://play.google.com/store/apps/details?id=com.arkgame.ft",
|
||||
"APP_Store_URL": "https://apps.apple.com/us/app/id6505145935",
|
||||
"HeartBeat": "60",
|
||||
"RTMPid": "80000586",
|
||||
"RTMServerEndpoint": "rtm-intl-frontgate.ilivedata.com:13321",
|
||||
"RTMHmacSecret": "57047697437f4f2c97a835e8d9a53358",
|
||||
"FuncUrl": "https://leaderboardcreate.azurewebsites.net",
|
||||
"FuncKey": "R5kU45fNBRd52Eqp3tEqfpZqrbFw53uSSEo7wraUSqIfAzFuRmLm_w==",
|
||||
"NewFeature": "enabled"
|
||||
},
|
||||
"ios": {
|
||||
"EventApiURL": "https://n3backend.azurewebsites.net/",
|
||||
"Ver": "0.30.2jkl012",
|
||||
"PlayFabTitle": "B066F",
|
||||
"Google_Play_URL": "https://play.google.com/store/apps/details?id=com.arkgame.ft",
|
||||
"APP_Store_URL": "https://apps.apple.com/us/app/id6505145935",
|
||||
"HeartBeat": "60",
|
||||
"RTMPid": "80000586",
|
||||
"RTMServerEndpoint": "rtm-intl-frontgate.ilivedata.com:13321",
|
||||
"RTMHmacSecret": "57047697437f4f2c97a835e8d9a53358",
|
||||
"FuncUrl": "https://leaderboardcreate.azurewebsites.net",
|
||||
"FuncKey": "R5kU45fNBRd52Eqp3tEqfpZqrbFw53uSSEo7wraUSqIfAzFuRmLm_w==",
|
||||
"NewFeature": "enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# 创建测试目录结构
|
||||
for version, platforms in test_configs.items():
|
||||
version_path = f"test_data/ab/{version.replace('.', '_')}"
|
||||
os.makedirs(version_path, exist_ok=True)
|
||||
|
||||
for platform, config in platforms.items():
|
||||
filename = f"{platform}config.json"
|
||||
filepath = os.path.join(version_path, filename)
|
||||
|
||||
# 加密配置并保存
|
||||
config_json = json.dumps(config, indent=2, ensure_ascii=False)
|
||||
encrypted_config = encrypt(config_json)
|
||||
|
||||
with open(filepath, 'w', encoding='utf-8') as f:
|
||||
f.write(encrypted_config)
|
||||
|
||||
print(f"创建测试文件: {filepath}")
|
||||
|
||||
print("测试配置文件创建完成!")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
create_test_configs()
|
||||
5
tests/integration/__init__.py
Normal file
5
tests/integration/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
"""
|
||||
集成测试
|
||||
|
||||
测试模块间的集成功能。
|
||||
"""
|
||||
5
tests/unit/__init__.py
Normal file
5
tests/unit/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
"""
|
||||
单元测试
|
||||
|
||||
测试各个模块的独立功能。
|
||||
"""
|
||||
Reference in New Issue
Block a user