44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
|
|
|
|
def read(path: str) -> str:
|
|
return (ROOT / path).read_text(encoding="utf-8")
|
|
|
|
|
|
def test_no_interest_is_distinct_from_lost_opportunity():
|
|
opp = read("app/opportunity_service.py")
|
|
admin = read("app/admin_dashboard.py")
|
|
|
|
assert '"NO_INTEREST": "Sem interesse"' in opp
|
|
assert '"MARK_NO_INTEREST": "NO_INTEREST"' in opp
|
|
assert '"NO_INTEREST": 118' in opp
|
|
assert '("closed", "Fechadas", ["WON", "LOST", "NO_INTEREST"])' in opp
|
|
assert '"NO_INTEREST": "Sem interesse"' in admin
|
|
assert 'não é o mesmo que oportunidade perdida' in admin
|
|
|
|
|
|
def test_operations_queue_filters_manually_cleaned_outbox_noise():
|
|
ops = read("app/operations_service.py")
|
|
assert "limpo manualmente" in ops
|
|
assert "resolvido manualmente" in ops
|
|
assert "_is_manually_resolved_error" in ops
|
|
assert "COALESCE(last_error,'') NOT ILIKE '%limpo manualmente%'" in ops
|
|
assert "Classificação da mensagem falhou" in ops
|
|
|
|
|
|
def test_operations_labels_are_not_inbox_labels():
|
|
operations_page = read("app/admin_ui/pages/operations.py")
|
|
assert "Mensagens para revisão" in operations_page
|
|
assert "Mensagens sem cliente" in operations_page
|
|
assert "Emails por tratar" not in operations_page
|
|
assert "Sem cliente', counts.get('communications_without_customer'" not in operations_page
|
|
|
|
|
|
def test_ignore_manually_cleaned_outbox_script_exists():
|
|
script = read("scripts/ignore_manually_cleaned_outbox.py")
|
|
assert "limpo manualmente" in script
|
|
assert "status = 'ignored'" in script
|
|
assert "--dry-run" in script
|