mirror of
https://github.com/BEDOLAGA-DEV/remnawave-bedolaga-telegram-bot.git
synced 2026-04-29 01:00:03 +00:00
- Add pyproject.toml with uv and ruff configuration - Pin Python version to 3.13 via .python-version - Add Makefile commands: lint, format, fix - Apply ruff formatting to entire codebase - Remove unused imports (base64 in yookassa/simple_subscription) - Update .gitignore for new config files
26 lines
843 B
Python
26 lines
843 B
Python
import logging
|
|
|
|
import pytest
|
|
|
|
from app.services.platega_service import PlategaService
|
|
|
|
|
|
def test_sanitize_description_limits_utf8_bytes(caplog: pytest.LogCaptureFixture) -> None:
|
|
caplog.set_level(logging.DEBUG)
|
|
original = 'Интернет-сервис - Пополнение баланса на 50 ₽ и ещё чуть-чуть'
|
|
|
|
trimmed = PlategaService._sanitize_description(original, 64)
|
|
|
|
assert len(trimmed.encode('utf-8')) <= 64
|
|
assert trimmed != original
|
|
assert any('trimmed' in record.message for record in caplog.records)
|
|
|
|
|
|
def test_sanitize_description_returns_clean_value() -> None:
|
|
original = ' Обычное описание '
|
|
|
|
trimmed = PlategaService._sanitize_description(original, 64)
|
|
|
|
assert trimmed == 'Обычное описание'
|
|
assert len(trimmed.encode('utf-8')) <= 64
|