PaiGram/tests/test_abyss_team_data.py
omg-xtao 1541c8fabc
支持深境螺旋推荐配队
Co-authored-by: 洛水居室 <luoshuijs@outlook.com>
2022-10-07 00:30:38 +08:00

34 lines
1.1 KiB
Python

import logging
import pytest
import pytest_asyncio
from flaky import flaky
from modules.apihelper.abyss_team import AbyssTeamData, TeamRateResult, TeamRate
LOGGER = logging.getLogger(__name__)
@pytest_asyncio.fixture
async def abyss_team_data():
_abyss_team_data = AbyssTeamData()
yield _abyss_team_data
await _abyss_team_data.close()
# noinspection PyShadowingNames
@pytest.mark.asyncio
@flaky(3, 1)
async def test_abyss_team_data(abyss_team_data: AbyssTeamData):
team_data = await abyss_team_data.get_data()
assert isinstance(team_data, TeamRateResult)
assert isinstance(team_data.rateListUp[0], TeamRate)
assert isinstance(team_data.rateListUp[-1], TeamRate)
assert isinstance(team_data.rateListDown[0], TeamRate)
assert isinstance(team_data.rateListDown[-1], TeamRate)
assert team_data.userCount > 0
for i in team_data.rateListUp[0].formation:
LOGGER.info("rate down info:name %s star %s", i.name, i.star)
for i in team_data.rateListDown[0].formation:
LOGGER.info("rate up info:name %s star %s", i.name, i.star)