mirror of
https://github.com/remnawave/python-sdk.git
synced 2026-08-27 11:51:50 +00:00
- Implemented models for nodes usage history including NodeInfoDto, GetUserAccessibleNodesResponse, and usage statistics. - Created subscription-related models such as UserSubscription, SubscriptionInfoData, and various response DTOs for subscription information. - Developed models for subscription settings, templates, and system statistics, enhancing the API's capability to manage and retrieve subscription configurations. - Introduced user management models including CreateUserRequestDto, UpdateUserRequestDto, and various response DTOs for user actions. - Added bulk actions for user updates and statistics tracking, improving the efficiency of user management operations. - Established a base controller for handling API requests and responses, along with decorators for HTTP methods to streamline API interactions. - Included utility functions for serialization using orjson for better performance with Pydantic models.
47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
import random
|
|
import uuid
|
|
|
|
import pytest
|
|
|
|
from remnawave.models import (
|
|
CreateUserHwidDeviceRequestDto,
|
|
DeleteUserHwidDeviceRequestDto,
|
|
CreateUserHwidDeviceResponseDto,
|
|
DeleteUserHwidDeviceResponseDto,
|
|
GetUserHwidDevicesResponseDto,
|
|
)
|
|
from tests.conftest import REMNAWAVE_USER_UUID
|
|
|
|
new_hwid = str(uuid.uuid4())
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_get_hwid_user(remnawave):
|
|
hwid = await remnawave.hwid.get_hwid_user(uuid=REMNAWAVE_USER_UUID)
|
|
assert isinstance(hwid, GetUserHwidDevicesResponseDto)
|
|
assert hwid.devices is not None
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_add_hwid_to_user(remnawave):
|
|
create_request = CreateUserHwidDeviceRequestDto(
|
|
hwid=new_hwid,
|
|
user_uuid=REMNAWAVE_USER_UUID,
|
|
platform="Windows",
|
|
os_version="10.0.19042",
|
|
deviceModel="Surface Pro",
|
|
userAgent="Mozilla/5.0"
|
|
)
|
|
response = await remnawave.hwid.add_hwid_to_users(body=create_request)
|
|
assert isinstance(response, CreateUserHwidDeviceResponseDto)
|
|
assert any(item.hwid == new_hwid for item in response.devices)
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_delete_hwid_user(remnawave):
|
|
delete_request = DeleteUserHwidDeviceRequestDto(
|
|
hwid=new_hwid,
|
|
user_uuid=REMNAWAVE_USER_UUID
|
|
)
|
|
response = await remnawave.hwid.delete_hwid_to_user(body=delete_request)
|
|
assert isinstance(response, DeleteUserHwidDeviceResponseDto)
|
|
assert not any(item.hwid == new_hwid for item in response.devices)
|