30 lines
1.0 KiB
Python
30 lines
1.0 KiB
Python
import pytest
|
|
from pydantic import ValidationError
|
|
from app.schemas.auth_schema import LoginRequest, LoginResponse, UserSessionDTO
|
|
from app.schemas.workstation_schema import LaneModuleDTO, WorkstationStatusResponse
|
|
|
|
|
|
def test_login_request_valid():
|
|
req = LoginRequest(username="guardia", password="secret_password", workstation_name="TABLET_01")
|
|
assert req.username == "guardia"
|
|
assert req.password == "secret_password"
|
|
assert req.workstation_name == "TABLET_01"
|
|
|
|
|
|
def test_login_request_empty_fields_raises_validation_error():
|
|
with pytest.raises(ValidationError):
|
|
LoginRequest(username="", password="")
|
|
|
|
|
|
def test_workstation_status_response_schema():
|
|
mod = LaneModuleDTO(modulo_id=100004, nombre="ENTRADA VISITAS", address=98, es_entrada=True)
|
|
status = WorkstationStatusResponse(
|
|
workstation_name="CFT-DESK",
|
|
is_control_post=True,
|
|
workstation_id=100001,
|
|
modules=[mod],
|
|
)
|
|
assert status.is_control_post is True
|
|
assert len(status.modules) == 1
|
|
assert status.modules[0].modulo_id == 100004
|