mirror of
https://github.com/remnawave/python-sdk.git
synced 2026-05-13 20:26:50 +00:00
- Implemented TemplateResponseDto and UpdateTemplateRequestDto for subscription templates. - Created models for system statistics including CPU, memory, and bandwidth. - Developed user models for user creation, updates, and responses. - Added bulk actions for user updates and statistics tracking. - Introduced tests for authentication, bandwidth statistics, hosts, inbounds, key generation, nodes, subscriptions, and user management. - Enhanced utility functions for generating random strings, emails, and date ranges for testing.
24 lines
749 B
Python
24 lines
749 B
Python
import random
|
|
import string
|
|
from datetime import datetime, timedelta
|
|
from typing import Tuple
|
|
|
|
|
|
def generate_random_string(length: int = 8, chars: str = string.ascii_letters) -> str:
|
|
return "".join(random.choices(chars, k=length))
|
|
|
|
|
|
def generate_password(length: int) -> str:
|
|
return generate_random_string(
|
|
length=length, chars=string.ascii_letters + string.digits
|
|
)
|
|
|
|
|
|
def generate_email(length: int, chars: str = string.ascii_letters) -> str:
|
|
return generate_random_string(length=length, chars=chars) + "@mail.com"
|
|
|
|
|
|
def generate_isoformat_range() -> Tuple[str, str]:
|
|
start = (datetime.now() - timedelta(days=7)).isoformat(timespec="seconds")
|
|
end = datetime.now().isoformat(timespec="seconds")
|
|
return start, end
|