Inicio deja la tarjeta Sujeto obligado por una línea que lleva a /perfil-regulatorio: actividad, aviso desde el factor de la regla por la UMA del tenant e identificación. El perfil muestra la ley con su nombre completo, las autoridades, el acuerdo vigente, la actividad, los umbrales y la UMA con la fecha de su captura; el oficial ve el aviso de UMA desactualizada desde el 1 de febrero. La sigla de la ley sale de la barra superior y la ventana pasa al detalle de las alertas que la usan (A-02 y C-02).
472 lines
20 KiB
Python
472 lines
20 KiB
Python
"""Textos finales y pendientes de CHM (Pieza G, PR G2; brief v2.2): `app/textos.py`, la macro
|
|
`pendiente(clave)`, la portada y la agenda `docs/agenda_chm.md`.
|
|
|
|
Los pendientes no se muestran a la financiera: la macro solo marca la pantalla. La prueba central
|
|
recorre `textos.ubicaciones()` (leído de las plantillas), abre cada pantalla marcada y comprueba
|
|
que no lleva etiqueta; la agenda en `docs/` tiene que estar al día con el catálogo.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import html
|
|
import re
|
|
from collections.abc import Callable, Iterator
|
|
from datetime import UTC, date, datetime
|
|
from decimal import Decimal
|
|
from pathlib import Path
|
|
from types import SimpleNamespace
|
|
|
|
import pytest
|
|
import sqlalchemy as sa
|
|
from fastapi.testclient import TestClient
|
|
from sqlalchemy.orm import Session, sessionmaker
|
|
|
|
from app import audit, fechas, textos
|
|
from app.config import get_settings
|
|
from app.db import crear_engine, crear_session_factory
|
|
from app.importers import lists as importador_listas
|
|
from app.importers.chm_schema import importar_esquema
|
|
from app.main import crear_app
|
|
from app.models import (
|
|
Alerta,
|
|
Base,
|
|
Cliente,
|
|
Coincidencia,
|
|
Credito,
|
|
EvaluacionRiesgo,
|
|
Lista,
|
|
LoteCarga,
|
|
Pep,
|
|
ReglaAlerta,
|
|
)
|
|
from app.models.usuario import Rol
|
|
from app.routers import plantillas
|
|
from app.services import alertas as servicio_alertas
|
|
from app.services import cumplimiento as servicio_cumplimiento
|
|
from app.services import operaciones as servicio_carga
|
|
from app.services import riesgo as servicio_riesgo
|
|
from app.services import screening as servicio_screening
|
|
from seed.usuarios_demo import sembrar
|
|
from tests.test_expediente import CONTRASENAS, FIXTURE, entrar
|
|
|
|
DIR_LISTAS = Path(__file__).parent / "fixtures" / "listas"
|
|
DIR_PLANTILLAS = Path(__file__).resolve().parents[1] / "app" / "templates"
|
|
PAIS_GAFI = "Haití"
|
|
POR_VALIDAR = {
|
|
"ponderacion_morales",
|
|
"pep_bajo_nivel",
|
|
"paises_riesgo_medio",
|
|
"d04_solo_pagos",
|
|
"edad_excel",
|
|
"umbrales_screening",
|
|
}
|
|
POR_RATIFICAR = {"preponderancia", "umbral_18", "cuenta_b06", "manuales_b05_b07"}
|
|
# Plantillas de la línea de riesgo: ella coloca la macro y prueba sus pantallas.
|
|
DE_OTRA_LINEA = ("riesgo/", "laboratorio/", "evidencia/", "auditoria/")
|
|
|
|
|
|
@pytest.fixture
|
|
def fabrica(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> sessionmaker[Session]:
|
|
engine = crear_engine("sqlite://")
|
|
Base.metadata.create_all(engine)
|
|
fabrica = crear_session_factory(engine)
|
|
monkeypatch.setattr("app.db.SessionLocal", fabrica)
|
|
monkeypatch.setattr(get_settings(), "data_dir", tmp_path)
|
|
servicio_screening.vaciar_cache()
|
|
with fabrica() as sesion:
|
|
sembrar(sesion, CONTRASENAS)
|
|
sesion.commit()
|
|
importar_esquema(sesion, FIXTURE, "pytest", sal="sal-textos")
|
|
servicio_riesgo.evaluar_cartera(sesion, "inicial")
|
|
servicio_alertas.ejecutar_reglas(sesion, usuario="pytest")
|
|
for nombre, definicion in importador_listas.LISTAS.items():
|
|
archivo = next(DIR_LISTAS.glob(definicion.patron_archivo))
|
|
importador_listas.importar_lista(sesion, nombre, archivo, usuario="pytest")
|
|
sesion.commit()
|
|
with fabrica() as sesion:
|
|
audit.fijar_actor(sesion, "pytest", 1)
|
|
# Lo que la cartera real no trae: una persona moral, un país GAFI (E-02) y una
|
|
# coincidencia de screening contra una lista cargada.
|
|
tenant_id = sesion.scalar(sa.select(Cliente.tenant_id).limit(1))
|
|
sesion.add(
|
|
Cliente(
|
|
tenant_id=tenant_id,
|
|
created_by="pytest",
|
|
id_externo="moral-textos-0001",
|
|
tipo_persona="moral",
|
|
pais="México",
|
|
)
|
|
)
|
|
gafi = sesion.scalar(sa.select(Cliente).order_by(Cliente.id).limit(1))
|
|
gafi.pais = PAIS_GAFI
|
|
sesion.flush()
|
|
servicio_alertas.ejecutar_reglas(sesion, claves=["E-02"], cliente_ids=[gafi.id])
|
|
lista = sesion.scalar(sa.select(Lista).order_by(Lista.id).limit(1))
|
|
sesion.add(
|
|
Coincidencia(
|
|
tenant_id=tenant_id,
|
|
created_by="pytest",
|
|
lista_id=lista.id,
|
|
persona_id=gafi.id,
|
|
texto_lista="ENTRADA FICTICIA DE PRUEBA",
|
|
score=Decimal("91"),
|
|
decision="pendiente",
|
|
fuente="screening",
|
|
)
|
|
)
|
|
sesion.commit()
|
|
return fabrica
|
|
|
|
|
|
@pytest.fixture
|
|
def cliente(fabrica: sessionmaker[Session]) -> Iterator[TestClient]:
|
|
with TestClient(crear_app(), follow_redirects=False) as c:
|
|
yield c
|
|
|
|
|
|
def etiquetas(texto: str) -> set[str]:
|
|
return set(re.findall(r'data-pendiente="([a-z0-9_]+)"', texto))
|
|
|
|
|
|
def renderizar(fuente: str) -> str:
|
|
return plantillas.env.from_string(fuente).render()
|
|
|
|
|
|
# --- Catálogo y macro --------------------------------------------------------------------------
|
|
|
|
|
|
def test_catalogo_de_pendientes() -> None:
|
|
claves = [p.clave for p in textos.PENDIENTES]
|
|
assert len(claves) == len(set(claves)) == 10
|
|
assert {p.clave for p in textos.por_validar()} == POR_VALIDAR
|
|
assert {p.clave for p in textos.por_ratificar()} == POR_RATIFICAR
|
|
for p in textos.PENDIENTES:
|
|
assert p.texto and p.hoy and p.referencia
|
|
assert p.pregunta.strip().endswith("?"), p.clave
|
|
# Los ratificables son exactamente los que el brief v2.1 da por decididos.
|
|
assert all("Brief v2.1" in p.referencia for p in textos.por_ratificar())
|
|
with pytest.raises(KeyError, match="desconocido"):
|
|
textos.pendiente("no_existe")
|
|
|
|
|
|
def test_la_macro_marca_pero_no_pinta_nada() -> None:
|
|
"""Los pendientes son entre Collina y CHM: la financiera no los ve (brief v2.2)."""
|
|
importar = '{% from "_componentes/pendiente.html" import pendiente, pendiente_de_regla %}'
|
|
for clave in POR_VALIDAR | POR_RATIFICAR:
|
|
assert renderizar(importar + f'{{{{ pendiente("{clave}") }}}}').strip() == ""
|
|
for regla in ("D-04", "B-06", "A-01"):
|
|
assert renderizar(importar + f'{{{{ pendiente_de_regla("{regla}") }}}}').strip() == ""
|
|
with pytest.raises(KeyError):
|
|
renderizar(importar + '{{ pendiente("no_existe") }}')
|
|
|
|
|
|
def test_las_plantillas_solo_usan_claves_del_catalogo() -> None:
|
|
llamada = re.compile(r"""\bpendiente\(\s*["']([a-z0-9_]+)["']""")
|
|
comentario = re.compile(r"\{#.*?#\}", re.DOTALL)
|
|
usadas = set()
|
|
for archivo in DIR_PLANTILLAS.rglob("*.html"):
|
|
usadas |= set(llamada.findall(comentario.sub("", archivo.read_text(encoding="utf-8"))))
|
|
assert usadas <= {p.clave for p in textos.PENDIENTES}
|
|
assert set(textos.PENDIENTES_POR_REGLA.values()) <= {p.clave for p in textos.PENDIENTES}
|
|
# Cada pendiente por validar aparece al menos en una pantalla.
|
|
assert POR_VALIDAR <= set(textos.ubicaciones())
|
|
|
|
|
|
def test_marco_regulatorio() -> None:
|
|
tenant = SimpleNamespace(
|
|
nombre="Financiera Demo",
|
|
regimen="LFPIORPI",
|
|
actividad_vulnerable="Art. 17 fracción IV",
|
|
uma_vigente=Decimal("117.31"),
|
|
fecha_corte=date(2026, 8, 31),
|
|
ventana_meses=6,
|
|
)
|
|
marco = textos.marco_regulatorio(tenant, 1605, "v2")
|
|
assert marco.regimen.nombre == (
|
|
"Ley Federal para la Prevención e Identificación de Operaciones con Recursos de "
|
|
"Procedencia Ilícita"
|
|
)
|
|
assert not hasattr(marco.regimen, "sigla") # la plataforma nunca muestra la sigla
|
|
assert marco.actividad.referencia == "Artículo 17, fracción IV"
|
|
assert marco.umbral_uma == 1605 and marco.umbral_pesos == Decimal("188282.55")
|
|
assert marco.regla_umbral == "A-01 v2"
|
|
assert marco.encabezado == (
|
|
"Artículo 17, fracción IV · Aviso desde $188,282.55 (1,605 UMA de $117.31) · "
|
|
"Identificación de todos los clientes"
|
|
)
|
|
assert marco.acuerdo.entrada_en_vigor == date(2026, 11, 30)
|
|
for fuera in ("obligaciones", "fecha_corte", "ventana_meses"):
|
|
assert not hasattr(marco, fuera), fuera # salen de la vista del marco
|
|
sin_regla = textos.marco_regulatorio(tenant, None)
|
|
assert sin_regla.umbral_uma is None and sin_regla.umbral_pesos is None
|
|
assert sin_regla.aviso == "Sin regla de umbral de aviso vigente"
|
|
assert textos.actividad("otra cosa").referencia == "otra cosa"
|
|
|
|
|
|
# --- Pantallas ---------------------------------------------------------------------------------
|
|
|
|
|
|
def _con_carga(fabrica: sessionmaker[Session], el: datetime) -> None:
|
|
"""Un lote del módulo 1 ya cargado (la fixture solo trae la migración del esquema)."""
|
|
with fabrica() as sesion:
|
|
tenant = servicio_alertas.tenant_de_sesion(sesion)
|
|
sesion.add(
|
|
LoteCarga(
|
|
tenant_id=tenant.id,
|
|
created_by="pytest",
|
|
created_at=el,
|
|
tipo=servicio_carga.TIPO_LOTE,
|
|
archivo_hash="0" * 64,
|
|
usuario="pytest",
|
|
estado=servicio_carga.TERMINADO,
|
|
)
|
|
)
|
|
sesion.commit()
|
|
|
|
|
|
def _estado(fabrica: sessionmaker[Session], hoy: date | None = None) -> dict:
|
|
with fabrica() as sesion:
|
|
tenant = servicio_alertas.tenant_de_sesion(sesion)
|
|
renglones = servicio_cumplimiento.estado(sesion, tenant, Decimal("188282.55"), hoy)
|
|
return {r.clave: r for r in renglones}
|
|
|
|
|
|
def test_estado_de_cumplimiento_en_la_empresa(fabrica: sessionmaker[Session]) -> None:
|
|
hoy = fechas.hoy()
|
|
with fabrica() as sesion:
|
|
clientes = sesion.scalar(sa.select(sa.func.count(Cliente.id)))
|
|
evaluados = sesion.scalar(
|
|
sa.select(sa.func.count(sa.func.distinct(EvaluacionRiesgo.cliente_id)))
|
|
)
|
|
abiertas, fuera, avisos_fuera = (
|
|
sesion.scalar(
|
|
sa.select(sa.func.count(Alerta.id)).where(
|
|
Alerta.estado.in_(servicio_alertas.ESTADOS_ABIERTOS), *condicion
|
|
)
|
|
)
|
|
for condicion in (
|
|
(),
|
|
(Alerta.vence_el < hoy,),
|
|
(Alerta.vence_el < hoy, Alerta.plazo_aviso == "aviso"),
|
|
)
|
|
)
|
|
a01_agosto = sesion.scalar(
|
|
sa.select(sa.func.count(Credito.id)).where(
|
|
Credito.fecha_disposicion.between(date(2026, 8, 1), date(2026, 8, 31)),
|
|
Credito.monto >= Decimal("188282.55"),
|
|
)
|
|
)
|
|
estado = _estado(fabrica)
|
|
assert list(estado) == ["carga", "avisos", "alertas", "clasificacion", "screening"]
|
|
|
|
# Sin cargas por el módulo 1 (solo la migración del esquema): el periodo está vencido.
|
|
carga = estado["carga"]
|
|
assert carga.partes == ["último corte 31/08/2026", "sin cargas"] and carga.vencido
|
|
assert carga.enlace == "/carga"
|
|
|
|
avisos = estado["avisos"]
|
|
assert avisos_fuera > 0 # el fixture no tiene créditos de agosto sobre el umbral
|
|
assert avisos.partes[:2] == [
|
|
f"{a01_agosto} operaciones superan el umbral en agosto de 2026",
|
|
"fecha límite 17/09/2026",
|
|
]
|
|
assert avisos.partes[2] == f"{avisos_fuera:,} avisos sin atender en plazo" and avisos.vencido
|
|
|
|
alertas = estado["alertas"]
|
|
assert alertas.partes == [f"{abiertas:,} abiertas", f"{fuera:,} fuera de plazo"]
|
|
assert alertas.vencido and alertas.enlace == "/alertas?vencidas=1"
|
|
|
|
# La persona moral del fixture no tiene evaluación: falta un cliente.
|
|
clasificacion = estado["clasificacion"]
|
|
assert clientes - evaluados == 1 and clasificacion.vencido
|
|
assert clasificacion.partes[0] == "1 cliente sin evaluar"
|
|
assert clasificacion.partes[1].startswith("última reevaluación ")
|
|
|
|
screening = estado["screening"]
|
|
assert screening.partes[0] == "1 coincidencia pendiente de confirmar" and screening.vencido
|
|
assert screening.partes[1].startswith("listas actualizadas el ")
|
|
|
|
|
|
def test_nada_vencido_antes_de_los_plazos(fabrica: sessionmaker[Session]) -> None:
|
|
"""Visto antes de cualquier fecha límite: ni la carga ni los plazos están vencidos."""
|
|
_con_carga(fabrica, datetime(2000, 1, 1, 18, tzinfo=UTC))
|
|
estado = _estado(fabrica, date(2000, 1, 15))
|
|
assert estado["carga"].partes[1] == "última carga 01/01/2000"
|
|
assert not estado["carga"].vencido and not estado["avisos"].vencido
|
|
assert estado["alertas"].partes[1] == "0 fuera de plazo"
|
|
assert estado["alertas"].enlace == "/alertas"
|
|
|
|
|
|
def test_la_carga_vencida_dice_hace_cuantos_dias(fabrica: sessionmaker[Session]) -> None:
|
|
# Periodo de un mes: la carga del 10 de julio vence el 10 de agosto; el 1 de septiembre
|
|
# van 22 días.
|
|
_con_carga(fabrica, datetime(2026, 7, 10, 18, tzinfo=UTC))
|
|
carga = _estado(fabrica, date(2026, 9, 1))["carga"]
|
|
assert carga.vencido
|
|
assert carga.partes == [
|
|
"último corte 31/08/2026",
|
|
"última carga 10/07/2026",
|
|
"periodo vencido hace 22 días",
|
|
]
|
|
assert not _estado(fabrica, date(2026, 8, 1))["carga"].vencido
|
|
|
|
|
|
def test_inicio_muestra_el_marco_el_estado_de_cumplimiento_y_los_pasos(
|
|
cliente: TestClient,
|
|
) -> None:
|
|
entrar(cliente, Rol.AUDITOR)
|
|
pagina = cliente.get("/inicio")
|
|
assert pagina.status_code == 200
|
|
texto = html.unescape(pagina.text)
|
|
for esperado in (
|
|
"Artículo 17, fracción IV · Aviso desde $188,282.55 (1,605 UMA de $117.31) · "
|
|
"Identificación de todos los clientes",
|
|
'href="/perfil-regulatorio"',
|
|
"Estado de cumplimiento",
|
|
"último corte 31/08/2026",
|
|
"fecha límite 17/09/2026",
|
|
"fuera de plazo",
|
|
"1 cliente sin evaluar",
|
|
"1 coincidencia pendiente de confirmar",
|
|
):
|
|
assert esperado in texto, esperado
|
|
# Las fechas de exigibilidad del Acuerdo ya no están en la plataforma.
|
|
for fuera in (
|
|
"Obligaciones próximas", "01/03/2027", "01/06/2027", "01/01/2028", "calendario",
|
|
"LFPIORPI", "Sujeto obligado", "(28/02/2026, 31/08/2026]",
|
|
): # fmt: skip
|
|
assert fuera not in texto, fuera
|
|
assert "urgencia" not in texto.lower() and "proyecto" not in texto.lower()
|
|
for clave, enlace in (("alertas", "/alertas?vencidas=1"), ("screening", "/screening")):
|
|
fila = texto.split(f'data-renglon="{clave}"')[1].split("</li>")[0]
|
|
assert 'data-vencido="si"' in fila and f'href="{enlace}"' in fila, clave
|
|
assert "badge--peligro" in fila, clave
|
|
fila = texto.split('data-renglon="carga"')[1].split("</li>")[0]
|
|
assert "sin cargas" in fila and 'data-vencido="si"' in fila
|
|
fila = texto.split('data-renglon="clasificacion"')[1].split("</li>")[0]
|
|
assert 'href="/riesgo"' in fila and "última reevaluación " in fila
|
|
recorrido = texto.split('class="recorrido"')[1].split("</ol>")[0]
|
|
assert recorrido.count('class="recorrido__paso') == 10
|
|
assert recorrido.count("es-deshabilitado") == 0
|
|
assert etiquetas(pagina.text) == set()
|
|
assert "/pendientes-chm" not in pagina.text and "pendiente de validación" not in texto.lower()
|
|
|
|
|
|
@pytest.mark.parametrize("rol", list(Rol))
|
|
def test_la_agenda_no_es_una_pantalla_de_la_financiera(cliente: TestClient, rol: Rol) -> None:
|
|
entrar(cliente, rol)
|
|
assert cliente.get("/pendientes-chm").status_code == 404
|
|
assert "Pendientes de CHM" not in cliente.get("/inicio").text
|
|
|
|
|
|
def test_la_agenda_es_un_documento_al_dia() -> None:
|
|
agenda = textos.agenda_markdown()
|
|
for p in textos.PENDIENTES:
|
|
assert f"(`{p.clave}`)" in agenda
|
|
assert p.pregunta in agenda and p.hoy in agenda
|
|
por_ratificar = agenda.split("## Para ratificar por escrito")[1]
|
|
assert all(f"(`{clave}`)" in por_ratificar for clave in POR_RATIFICAR)
|
|
for clave, lugares in textos.ubicaciones().items():
|
|
if clave in POR_VALIDAR:
|
|
assert all(f"(`{u.plantilla}`)" in agenda for u in lugares)
|
|
assert textos.RUTA_AGENDA.read_text(encoding="utf-8") == agenda, (
|
|
"docs/agenda_chm.md está desactualizado: python -m app.textos --agenda"
|
|
)
|
|
|
|
|
|
def _urls(sesion: Session) -> dict[str, Callable[[str], str]]:
|
|
"""Plantilla → cómo abrir una pantalla que la usa con la etiqueta de `clave` visible."""
|
|
|
|
def lote_preparado() -> str:
|
|
"""Un lote de carga por confirmar: su pantalla lleva la marca de D-04."""
|
|
from app.models import LoteCarga, Tenant
|
|
|
|
lote = LoteCarga(
|
|
tenant_id=sesion.scalar(sa.select(Tenant.id)), created_by="pytest",
|
|
tipo="operaciones", archivo_hash="0" * 64, usuario="pytest", estado="preparado",
|
|
filas={"total": 1, "aceptadas": 1, "rechazadas": 0},
|
|
) # fmt: skip
|
|
sesion.add(lote)
|
|
sesion.commit()
|
|
return f"/carga/lotes/{lote.id}"
|
|
|
|
def alerta_de(clave: str) -> Alerta:
|
|
reglas = [r for r, c in textos.PENDIENTES_POR_REGLA.items() if c == clave]
|
|
alerta = sesion.scalar(
|
|
sa.select(Alerta)
|
|
.join(ReglaAlerta, ReglaAlerta.id == Alerta.regla_id)
|
|
.where(ReglaAlerta.clave.in_(reglas))
|
|
.order_by(Alerta.id)
|
|
.limit(1)
|
|
)
|
|
assert alerta is not None, f"no hay alerta de {reglas} en el fixture"
|
|
return alerta
|
|
|
|
def bandeja(clave: str) -> str:
|
|
alerta = alerta_de(clave)
|
|
familia = sesion.get(ReglaAlerta, alerta.regla_id).familia
|
|
return f"/alertas?familia={familia}&cliente_id={alerta.cliente_id}"
|
|
|
|
def ficha(clave: str) -> str:
|
|
if clave == "ponderacion_morales":
|
|
consulta = sa.select(Cliente.id).where(Cliente.tipo_persona == "moral")
|
|
elif clave == "pep_bajo_nivel":
|
|
consulta = sa.select(Pep.persona_id).where(Pep.tipo == "nacional")
|
|
else:
|
|
consulta = sa.select(Cliente.id).where(Cliente.fecha_nacimiento.is_not(None))
|
|
return f"/clientes/{sesion.scalar(consulta.limit(1))}"
|
|
|
|
def coincidencia(_clave: str) -> str:
|
|
con_lista = sa.select(Coincidencia.id).where(Coincidencia.lista_id.is_not(None))
|
|
return f"/screening/{sesion.scalar(con_lista.limit(1))}"
|
|
|
|
return {
|
|
"alertas/bandeja.html": bandeja,
|
|
"alertas/detalle.html": lambda clave: f"/alertas/{alerta_de(clave).id}",
|
|
"clientes/ficha.html": ficha,
|
|
"expediente/index.html": lambda _: "/expediente",
|
|
"expediente/nuevo.html": lambda _: "/clientes/nuevo?tipo=moral",
|
|
"expediente/_campos_identificacion.html": lambda _: "/clientes/nuevo?tipo=fisica",
|
|
"screening/index.html": lambda _: "/screening",
|
|
"screening/listas.html": lambda _: "/screening/listas",
|
|
"screening/detalle.html": coincidencia,
|
|
"carga/lote.html": lambda _: lote_preparado(),
|
|
}
|
|
|
|
|
|
def test_ninguna_pantalla_marcada_pinta_la_etiqueta(fabrica, cliente: TestClient) -> None:
|
|
"""Cada pantalla que la agenda dice que un tema afecta se abre sin etiqueta de pendiente."""
|
|
entrar(cliente, Rol.OFICIAL) # el alta (expediente/nuevo) es solo del oficial
|
|
revisadas = 0
|
|
with fabrica() as sesion:
|
|
urls = _urls(sesion)
|
|
for clave, lugares in sorted(textos.ubicaciones().items()):
|
|
if clave not in POR_VALIDAR:
|
|
continue
|
|
for plantilla in sorted({u.plantilla for u in lugares}):
|
|
if plantilla.startswith(DE_OTRA_LINEA):
|
|
continue
|
|
assert plantilla in urls, f"agrega a _urls cómo abrir {plantilla}"
|
|
url = urls[plantilla](clave)
|
|
pagina = cliente.get(url)
|
|
assert pagina.status_code == 200, url
|
|
assert not etiquetas(pagina.text), url
|
|
assert "pendiente de validación" not in pagina.text.lower(), url
|
|
revisadas += 1
|
|
assert revisadas >= 15
|
|
|
|
|
|
def test_lo_ratificado_tampoco_lleva_etiqueta(fabrica, cliente: TestClient) -> None:
|
|
"""B-06 (CUENTA) y B-05/B-07 (manuales) están decididos en el brief: sin etiqueta."""
|
|
entrar(cliente, Rol.ANALISTA)
|
|
with fabrica() as sesion:
|
|
b06 = sesion.scalar(
|
|
sa.select(Alerta)
|
|
.join(ReglaAlerta, ReglaAlerta.id == Alerta.regla_id)
|
|
.where(ReglaAlerta.clave == "B-06")
|
|
.limit(1)
|
|
)
|
|
pagina = cliente.get(f"/alertas/{b06.id}")
|
|
assert pagina.status_code == 200
|
|
assert not etiquetas(pagina.text) & POR_RATIFICAR
|