Files
scrap/tests/api/test_logs_endpoints.py
Gilles Soulier 152c2724fc feat: improve SPA scraping and increase test coverage
- Add SPA support for Playwright with wait_for_network_idle and extra_wait_ms
- Add BaseStore.get_spa_config() and requires_playwright() methods
- Implement AliExpress SPA config with JSON price extraction patterns
- Fix Amazon price parsing to prioritize whole+fraction combination
- Fix AliExpress regex patterns (remove double backslashes)
- Add CLI tests: detect, doctor, fetch, parse, run commands
- Add API tests: auth, logs, products, scraping_logs, webhooks

Tests: 417 passed, 85% coverage

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-17 14:46:55 +01:00

27 lines
777 B
Python

"""Tests pour les endpoints de logs API."""
from pricewatch.app.api.main import list_backend_logs, BACKEND_LOGS
from pricewatch.app.api.schemas import BackendLogEntry
def test_list_backend_logs_empty():
"""Liste des logs backend vide."""
BACKEND_LOGS.clear()
result = list_backend_logs()
assert result == []
def test_list_backend_logs_with_entries():
"""Liste des logs backend avec entrees."""
from datetime import datetime
BACKEND_LOGS.clear()
entry = BackendLogEntry(level="INFO", message="Test log", time=datetime(2026, 1, 17, 12, 0, 0))
BACKEND_LOGS.append(entry)
result = list_backend_logs()
assert len(result) == 1
assert result[0].message == "Test log"
assert result[0].level == "INFO"
BACKEND_LOGS.clear()