SIMNet/tests/test_lab_client.py

38 lines
1.1 KiB
Python
Raw Permalink Normal View History

2023-05-08 02:00:01 +00:00
from typing import TYPE_CHECKING
import pytest
import pytest_asyncio
from simnet.client.components.lab import LabClient
2023-12-27 07:09:24 +00:00
from simnet.utils.enums import Game
2023-05-08 02:00:01 +00:00
if TYPE_CHECKING:
from simnet.client.cookies import Cookies
2023-12-27 07:09:24 +00:00
from simnet.utils.enums import Region
2023-05-08 02:00:01 +00:00
@pytest_asyncio.fixture
async def client_instance(account_id: int, region: "Region", cookies: "Cookies"):
2023-05-08 02:00:01 +00:00
async with LabClient(
cookies=cookies,
account_id=account_id,
region=region,
2023-05-08 02:00:01 +00:00
) as client_instance:
yield client_instance
@pytest.mark.asyncio
class TestStarRailClient:
@staticmethod
async def test_get_user_info(account_id: int, client_instance: "LabClient"):
user_info = await client_instance.get_user_info()
assert user_info.nickname
assert user_info.accident_id == account_id
@staticmethod
async def test_get_genshin_accounts(client_instance: "LabClient"):
genshin_accounts = await client_instance.get_genshin_accounts()
for genshin_account in genshin_accounts:
assert genshin_account.game == Game.GENSHIN
assert len(str(genshin_account.uid)) == 9