Update tests

This commit is contained in:
洛水居室 2023-05-11 16:39:04 +08:00
parent 9731216a08
commit 859c21c4f5
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 29 additions and 6 deletions

View File

@ -41,3 +41,13 @@ class TestGenshinBattleChronicleClient:
):
user = await genshin_client.get_partial_genshin_user()
assert user.stats.days_active >= 0
@staticmethod
async def test_get_genshin_characters(
genshin_client: GenshinBattleChronicleClient,
):
characters = await genshin_client.get_genshin_characters()
assert len(characters) > 0
for character in characters:
assert character.id
assert character.level

View File

@ -4,6 +4,7 @@ import pytest
import pytest_asyncio
from simnet.client.components.calculator.genshin import CalculatorClient
from simnet.client.components.chronicle.genshin import GenshinBattleChronicleClient
from simnet.utils.enum_ import Region
if TYPE_CHECKING:
@ -11,9 +12,7 @@ if TYPE_CHECKING:
@pytest_asyncio.fixture
async def calculator_client(
genshin_player_id: int, account_id: int, cookies: "Cookies"
):
async def calculator_client(genshin_player_id: int, account_id: int, cookies: "Cookies"):
async with CalculatorClient(
player_id=genshin_player_id,
cookies=cookies,
@ -23,13 +22,27 @@ async def calculator_client(
yield client_instance
@pytest_asyncio.fixture
async def genshin_battle_chronicle_client(genshin_player_id: int, account_id: int, cookies: "Cookies"):
async with GenshinBattleChronicleClient(
player_id=genshin_player_id,
cookies=cookies,
account_id=account_id,
region=Region.CHINESE,
) as client_instance:
yield client_instance
@pytest.mark.asyncio
class TestCalculatorClient:
@staticmethod
async def test_character_details(calculator_client: "CalculatorClient"):
character_details = await calculator_client.get_character_details(10000046)
async def test_character_details(
calculator_client: "CalculatorClient", genshin_battle_chronicle_client: "GenshinBattleChronicleClient"
):
characters = await genshin_battle_chronicle_client.get_genshin_characters()
character_details = await calculator_client.get_character_details(characters[-1].id)
assert len(character_details.talents) == 6
for talent in character_details.talents:
assert talent.level == 10 or talent.max_level == 13 or talent.max_level == 1
assert talent.level > -1
for artifact in character_details.artifacts:
assert artifact.level >= 0