feat(puesto-control): paridad total de validaciones, seguro automotor, ART y UX tablet 9-11 pulgadas
This commit is contained in:
@@ -206,6 +206,7 @@ async def test_lot_permission_and_occupants_api():
|
||||
"apellido": "GARCIA",
|
||||
"nombre": "ROBERTO",
|
||||
"patente": "GRC888",
|
||||
"lote_codigo": "1",
|
||||
"cantidad_ocupantes": 3,
|
||||
"abrir_barrera": False,
|
||||
"integrantes": [
|
||||
@@ -272,3 +273,95 @@ async def test_lot_permission_and_occupants_api():
|
||||
cursor.execute("DELETE FROM tckper WHERE TicketID = %s", (tid,))
|
||||
cursor.execute("DELETE FROM tck WHERE TicketID = %s", (tid,))
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_validations_and_policies():
|
||||
"""Valida los chequeos de paridad de OnEverAccess (documento, nombre, lote, seguro automotor, ART)."""
|
||||
transport = ASGITransport(app=app)
|
||||
async with AsyncClient(transport=transport, base_url="http://test") as client:
|
||||
login_res = await client.post(
|
||||
"/api/v1/auth/login",
|
||||
json={"username": "guardia", "password": "guardia"},
|
||||
)
|
||||
token = login_res.cookies.get("access_token")
|
||||
|
||||
# 1. Falta nombre -> 422
|
||||
res_no_nombre = await client.post(
|
||||
"/api/v1/access/entry",
|
||||
json={
|
||||
"modulo_ingreso_id": 100004,
|
||||
"documento": "11223344",
|
||||
"nombre": "",
|
||||
"lote_codigo": "100",
|
||||
"tipo_ingreso": "PEATON",
|
||||
},
|
||||
cookies={"access_token": token},
|
||||
)
|
||||
assert res_no_nombre.status_code == 422
|
||||
assert "nombre" in res_no_nombre.json()["detail"].lower()
|
||||
|
||||
# 2. Falta lote -> 422
|
||||
res_no_lote = await client.post(
|
||||
"/api/v1/access/entry",
|
||||
json={
|
||||
"modulo_ingreso_id": 100004,
|
||||
"documento": "11223344",
|
||||
"nombre": "CARLOS",
|
||||
"tipo_ingreso": "PEATON",
|
||||
},
|
||||
cookies={"access_token": token},
|
||||
)
|
||||
assert res_no_lote.status_code == 422
|
||||
assert "lote" in res_no_lote.json()["detail"].lower()
|
||||
|
||||
# 3. Conductor sin patente -> 422
|
||||
res_no_patente = await client.post(
|
||||
"/api/v1/access/entry",
|
||||
json={
|
||||
"modulo_ingreso_id": 100004,
|
||||
"documento": "11223344",
|
||||
"nombre": "CARLOS",
|
||||
"lote_codigo": "100",
|
||||
"tipo_ingreso": "CONDUCTOR",
|
||||
"patente": "",
|
||||
},
|
||||
cookies={"access_token": token},
|
||||
)
|
||||
assert res_no_patente.status_code == 422
|
||||
assert "patente" in res_no_patente.json()["detail"].lower()
|
||||
|
||||
# 4. Conductor con seguro automotor vencido -> 403
|
||||
res_seguro_vencido = await client.post(
|
||||
"/api/v1/access/entry",
|
||||
json={
|
||||
"modulo_ingreso_id": 100004,
|
||||
"documento": "11223344",
|
||||
"nombre": "CARLOS",
|
||||
"lote_codigo": "100",
|
||||
"tipo_ingreso": "CONDUCTOR",
|
||||
"patente": "ABC123",
|
||||
"seguro_hasta": "2020-01-01",
|
||||
},
|
||||
cookies={"access_token": token},
|
||||
)
|
||||
assert res_seguro_vencido.status_code == 403
|
||||
assert "seguro" in res_seguro_vencido.json()["detail"].lower()
|
||||
|
||||
# 5. Trabajador con ART vencida -> 403
|
||||
res_art_vencida = await client.post(
|
||||
"/api/v1/access/entry",
|
||||
json={
|
||||
"modulo_ingreso_id": 100004,
|
||||
"documento": "11223344",
|
||||
"nombre": "CARLOS",
|
||||
"lote_codigo": "100",
|
||||
"tipo_ingreso": "PEATON",
|
||||
"motivo": "TRABAJADOR DE OBRA",
|
||||
"art_hasta": "2021-05-10",
|
||||
},
|
||||
cookies={"access_token": token},
|
||||
)
|
||||
assert res_art_vencida.status_code == 403
|
||||
assert "art" in res_art_vencida.json()["detail"].lower()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user