51 lines
2.1 KiB
Python
51 lines
2.1 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_v485_bounce_ndr_is_ignored_without_task_or_opportunity():
|
|
catalog = read("app/action_catalog.py")
|
|
decider = read("app/action_decider.py")
|
|
analyzer = read("app/analyzer.py")
|
|
task_service = read("app/task_service.py")
|
|
opportunity = read("app/opportunity_service.py")
|
|
|
|
assert "IGNORE_BOUNCE" in catalog
|
|
assert "Your message" in decider or "couldn" in decider
|
|
assert "Recipient" in decider or "recipient" in decider
|
|
assert "Office 365" in decider or "office 365" in decider
|
|
assert 'action_result.action_code or "").upper() == "IGNORE_BOUNCE"' in analyzer
|
|
assert 'return None' in task_service
|
|
assert '"IGNORE_BOUNCE"' in opportunity
|
|
assert "unknown to address" in opportunity
|
|
|
|
|
|
def test_v485_operations_identity_is_operator_friendly_and_details_are_conditional():
|
|
vm = read("app/admin_ui/view_models/operations.py")
|
|
ops = read("app/admin_ui/pages/operations.py")
|
|
|
|
assert "operation_has_useful_details" in vm
|
|
assert "Contacto sem identificação" in vm
|
|
assert "_looks_like_generic_label" in vm
|
|
assert "Contacto Chatwoot #" in vm # legacy comment only, not the returned title
|
|
assert "operation_has_useful_details(item)" not in ops
|
|
assert 'status_chip_html = "" if status_text == "normal"' in ops
|
|
|
|
|
|
def test_v485_opportunity_cards_use_specific_cta_and_hide_low_value_fields():
|
|
opportunities = read("app/admin_ui/pages/opportunities.py")
|
|
|
|
assert "_opportunity_card_identity" in opportunities
|
|
assert "_opportunity_card_next_action" in opportunities
|
|
assert "primary_action_label" in opportunities
|
|
assert "Ver tarefa pendente" in opportunities
|
|
assert "cf-opportunity-card-compact" in opportunities
|
|
compact_card = opportunities.split('def _render_opportunity_card', 1)[1].split('def render_opportunities_board_partial', 1)[0]
|
|
assert "money_html(opp.get('value_amount'))" not in compact_card
|
|
assert "fmt_dt(opp.get('updated_at'))" not in compact_card
|
|
assert "pending_chip" not in compact_card
|