- 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>
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""Tests pour la commande CLI doctor."""
|
|
|
|
import pytest
|
|
from typer.testing import CliRunner
|
|
|
|
from pricewatch.app.cli.main import app
|
|
|
|
runner = CliRunner()
|
|
|
|
|
|
class TestDoctorCommand:
|
|
"""Tests pour la commande doctor."""
|
|
|
|
def test_doctor_success(self):
|
|
"""Doctor doit afficher le statut de l'installation."""
|
|
result = runner.invoke(app, ["doctor"])
|
|
assert result.exit_code == 0
|
|
assert "PriceWatch Doctor" in result.stdout
|
|
assert "Python" in result.stdout
|
|
# "prêt" avec accent
|
|
assert "prêt" in result.stdout.lower() or "ready" in result.stdout.lower()
|
|
|
|
def test_doctor_shows_dependencies(self):
|
|
"""Doctor doit lister les dependances."""
|
|
result = runner.invoke(app, ["doctor"])
|
|
assert result.exit_code == 0
|
|
assert "typer" in result.stdout.lower()
|
|
assert "pydantic" in result.stdout.lower()
|
|
assert "playwright" in result.stdout.lower()
|
|
|
|
def test_doctor_shows_stores(self):
|
|
"""Doctor doit lister les stores disponibles."""
|
|
result = runner.invoke(app, ["doctor"])
|
|
assert result.exit_code == 0
|
|
assert "amazon" in result.stdout.lower()
|
|
assert "cdiscount" in result.stdout.lower()
|