import base64 import json import sys import time from pathlib import Path import pytest from fastapi.testclient import TestClient sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from main import application @pytest.fixture def client(): return TestClient(application) @pytest.fixture def alter_token(): payload = { 'alter': 'MDAwMDAw', 'equVersion': '0', 'time': int(time.time() * 1000), } return base64.b64encode(json.dumps(payload).encode('utf-8')).decode('utf-8') @pytest.fixture def minimal_calc_config(): parts = [ '武器', '副武器', '称号', '上衣', '头肩', '下装', '腰带', '鞋', '手镯', '项链', '戒指', '辅助装备', '魔法石', '耳环', ] return { 'equips': { part: { 'id': '', 'reinforce': 0, 'reinforceType': 0, 'enchant': '0', 'refine': 0, 'adaptation': 0, } for part in parts }, 'oaths': {}, 'emblems': {}, 'skills': {}, 'avatar': {}, 'sundry': {}, 'jades': {}, 'options': {}, 'DSB': False, 'BUFF': False, }