feat(parity): implement Bloques 1, 2 y 3 complete feature parity v0.7.0-beta
This commit is contained in:
@@ -8,35 +8,40 @@ def test_checksum_and_formatting():
|
||||
assert formatear_comando_hardware(20, "T9") == "\x0220T90F\x03"
|
||||
|
||||
|
||||
def test_encolar_apertura_virtual_module_molinete_club():
|
||||
def test_encolar_apertura_virtual_module_entrada_visitas():
|
||||
"""
|
||||
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.
|
||||
Verifica que el Módulo Virtual 100009 (ENTRADA VISITAS):
|
||||
1. Se resuelva a la placa física 100002 (Address 3).
|
||||
2. Aplique payload V3 correspondiente a Barrera Pulso (tipo_acceso 5).
|
||||
3. Genere la trama de apertura \x0203V312\x03.
|
||||
4. Genere la trama T9 para impresión de ticket cuando corresponda.
|
||||
"""
|
||||
ok, res = HardwareService.encolar_apertura(modulo_id=100004, ticket_id=99999999)
|
||||
ok, res = HardwareService.encolar_apertura(modulo_id=100009, 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"
|
||||
assert res["modulo_solicitado"] == 100009
|
||||
assert res["modulo_fisico_target"] == 100002
|
||||
assert res["address"] == 3
|
||||
assert res["tipo_acceso"] == 5
|
||||
assert res["is_pass"] is True
|
||||
assert res["payload"] == "V3"
|
||||
assert res["comando_trama"] == "\x0203V312\x03"
|
||||
assert res["trama_ticket"] == "\x0203T90E\x03"
|
||||
|
||||
|
||||
def test_obtener_tipo_acceso_y_es_acceso_peatonal():
|
||||
"""
|
||||
Verifica que:
|
||||
1. Modulo 100004 sea detectado como Molinete Club (7) -> es_acceso_peatonal True.
|
||||
2. Modulo inexistente o 0 retorne 0 -> es_acceso_peatonal False.
|
||||
1. Modulo 100007 (ENTRADA PEATONAL) sea detectado como Puerta (1) -> es_acceso_peatonal True.
|
||||
2. Modulo 100009 (ENTRADA VISITAS) sea detectado como Barrera Pulso (5) -> es_acceso_peatonal False.
|
||||
3. Modulo inexistente o 0 retorne 0 -> es_acceso_peatonal False.
|
||||
"""
|
||||
tipo_acc = HardwareService.obtener_tipo_acceso(100004)
|
||||
assert tipo_acc == 7
|
||||
assert HardwareService.es_acceso_peatonal(100004) is True
|
||||
tipo_acc_peatonal = HardwareService.obtener_tipo_acceso(100007)
|
||||
assert tipo_acc_peatonal == 1
|
||||
assert HardwareService.es_acceso_peatonal(100007) is True
|
||||
|
||||
tipo_acc_vehicular = HardwareService.obtener_tipo_acceso(100009)
|
||||
assert tipo_acc_vehicular == 5
|
||||
assert HardwareService.es_acceso_peatonal(100009) is False
|
||||
|
||||
assert HardwareService.obtener_tipo_acceso(0) == 0
|
||||
assert HardwareService.es_acceso_peatonal(0) is False
|
||||
|
||||
Reference in New Issue
Block a user