feat(reception,udeci): v3.8.48 - forced scanner focus, spanish keyboard gun normalization, reception default dashboard, and udeci commission listings
This commit is contained in:
@@ -95,6 +95,21 @@ def test_qr_security_service_generate_and_decode(init_database):
|
||||
assert status_d == "AUTORIZADO"
|
||||
assert resolved_dni.id == student.id
|
||||
|
||||
# Fallback por formato institucional UNICABA:USR:<id>:DNI:<doc>
|
||||
res_fallback, status_fb, _ = QRSecurityService.decode_and_resolve_user(f"UNICABA:USR:{student.id}:DNI:{student.document_number}")
|
||||
assert status_fb == "AUTORIZADO"
|
||||
assert res_fallback.id == student.id
|
||||
|
||||
# Pistola óptica en teclado en español (sustituye : por Ñ)
|
||||
res_gun, status_gun, _ = QRSecurityService.decode_and_resolve_user(f"UNICABAÑUSRÑ{student.id}ÑDNIÑ{student.document_number}")
|
||||
assert status_gun == "AUTORIZADO"
|
||||
assert res_gun.id == student.id
|
||||
|
||||
# Pistola óptica con DNI vacío
|
||||
res_gun_nodni, status_gn, _ = QRSecurityService.decode_and_resolve_user(f"UNICABAÑUSRÑ{student.id}ÑDNIÑ")
|
||||
assert status_gn == "AUTORIZADO"
|
||||
assert res_gun_nodni.id == student.id
|
||||
|
||||
# Token corrupto o inválido
|
||||
res_fake, status_f, reason_f = QRSecurityService.decode_and_resolve_user("token_invalido_corrupto")
|
||||
assert status_f == "DENEGADO"
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
import pytest
|
||||
from app import create_app, db
|
||||
from app.models.user import User
|
||||
from app.models.career import Career
|
||||
from app.models.subject import Subject, Commission
|
||||
from app.services.live_context_service import LiveContextService
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def app_with_commissions():
|
||||
app = create_app('testing')
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
|
||||
# Seed sample career, subject, teacher, commission
|
||||
admin_user = User(
|
||||
name="Admin Test",
|
||||
email="admin@unicaba.edu.ar",
|
||||
password_hash="hashed_pw_test",
|
||||
role="ADMIN",
|
||||
is_active=True
|
||||
)
|
||||
docente_user = User(
|
||||
name="Profesor Carlos Sanchez",
|
||||
email="csanchez@unicaba.edu.ar",
|
||||
password_hash="hashed_pw_test",
|
||||
role="DOCENTE",
|
||||
is_active=True
|
||||
)
|
||||
db.session.add_all([admin_user, docente_user])
|
||||
db.session.commit()
|
||||
|
||||
career = Career(name="Tecnologías Digitales", code="TEC. DIG. (CCC)")
|
||||
db.session.add(career)
|
||||
db.session.commit()
|
||||
|
||||
subject1 = Subject(
|
||||
code="ASIG00120",
|
||||
name="Gestión de sistemas de información",
|
||||
career_id=career.id,
|
||||
is_active=True
|
||||
)
|
||||
subject2 = Subject(
|
||||
code="ASIG00121",
|
||||
name="Análisis de Datos I",
|
||||
career_id=career.id,
|
||||
is_active=True
|
||||
)
|
||||
db.session.add_all([subject1, subject2])
|
||||
db.session.commit()
|
||||
|
||||
comm1 = Commission(
|
||||
code="C1",
|
||||
subject_id=subject1.id,
|
||||
teacher_id=docente_user.id,
|
||||
semester="2",
|
||||
year=2026,
|
||||
shift="Tarde",
|
||||
max_students=30,
|
||||
current_students=5,
|
||||
active=True
|
||||
)
|
||||
comm2 = Commission(
|
||||
code="C1",
|
||||
subject_id=subject2.id,
|
||||
teacher_id=admin_user.id,
|
||||
semester="2",
|
||||
year=2026,
|
||||
shift="Tarde",
|
||||
max_students=30,
|
||||
current_students=0,
|
||||
active=True
|
||||
)
|
||||
db.session.add_all([comm1, comm2])
|
||||
db.session.commit()
|
||||
|
||||
yield app
|
||||
|
||||
db.session.remove()
|
||||
db.drop_all()
|
||||
|
||||
|
||||
def test_live_context_commission_listing(app_with_commissions):
|
||||
with app_with_commissions.app_context():
|
||||
# 1. Consulta explícita por listado de comisiones
|
||||
snapshot = LiveContextService.get_system_snapshot(
|
||||
role="admin",
|
||||
user_name="Administrador",
|
||||
query="dame un listado de comisiones"
|
||||
)
|
||||
assert "LISTADO COMPLETO DE COMISIONES ACTIVAS" in snapshot
|
||||
assert "Gestión de sistemas de información" in snapshot
|
||||
assert "ASIG00120" in snapshot
|
||||
assert "Profesor Carlos Sanchez" in snapshot
|
||||
assert "Análisis de Datos I" in snapshot
|
||||
|
||||
# 2. Consulta de docentes de las comisiones
|
||||
teacher_snapshot = LiveContextService.get_system_snapshot(
|
||||
role="admin",
|
||||
user_name="Administrador",
|
||||
query="dime el nombre de los proferes de esas comisiones"
|
||||
)
|
||||
assert "ASIGNACIÓN DE DOCENTES A COMISIONES ACTIVAS" in teacher_snapshot
|
||||
assert "Profesor Carlos Sanchez" in teacher_snapshot
|
||||
assert "Gestión de sistemas de información" in teacher_snapshot
|
||||
|
||||
# 3. Consulta de materias/asignaturas
|
||||
subj_snapshot = LiveContextService.get_system_snapshot(
|
||||
role="admin",
|
||||
user_name="Administrador",
|
||||
query="que materias hay en el sistema"
|
||||
)
|
||||
assert "LISTADO DE ASIGNATURAS ACTIVAS DEL SISTEMA" in subj_snapshot
|
||||
assert "Gestión de sistemas de información" in subj_snapshot
|
||||
assert "Análisis de Datos I" in subj_snapshot
|
||||
Reference in New Issue
Block a user