fix(hardware): replicar reglas exactas de puesto de control de escritorio para apertura de molinete club y comando T9
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import pytest
|
||||
from app.services.hardware_service import HardwareService, formatear_comando_hardware, calcular_checksum
|
||||
|
||||
|
||||
def test_checksum_and_formatting():
|
||||
assert calcular_checksum("\x0220O5") == "18"
|
||||
assert formatear_comando_hardware(20, "O5") == "\x0220O518\x03"
|
||||
assert formatear_comando_hardware(20, "T9") == "\x0220T90F\x03"
|
||||
|
||||
|
||||
def test_encolar_apertura_virtual_module_molinete_club():
|
||||
"""
|
||||
Verifica que el Módulo Virtual 100004 (ENTRADA VISITAS):
|
||||
1. Se resuelva a la placa física 100009 (Address 20).
|
||||
2. Aplique payload O5 correspondiente a Molinete Club (tipo_acceso 7).
|
||||
3. Genere la trama de apertura \x0220O518\x03.
|
||||
4. Genere la trama T9 para impresión de ticket \x0220T90F\x03 cuando tipo_identificacion == 1.
|
||||
"""
|
||||
ok, res = HardwareService.encolar_apertura(modulo_id=100004, ticket_id=99999999)
|
||||
assert ok is True
|
||||
assert res["modulo_solicitado"] == 100004
|
||||
assert res["modulo_fisico_target"] == 100009
|
||||
assert res["address"] == 20
|
||||
assert res["tipo_acceso"] == 7
|
||||
assert res["is_pass"] is False
|
||||
assert res["payload"] == "O5"
|
||||
assert res["comando_trama"] == "\x0220O518\x03"
|
||||
assert res["trama_ticket"] == "\x0220T90F\x03"
|
||||
Reference in New Issue
Block a user