Files
remnawave-bedolaga-telegram…/tests/services/test_platega_service.py
c0mrade 9a2aea038a chore: add uv package manager and ruff linter configuration
- 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
2026-01-24 17:45:27 +03:00

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