feat: complete Phases 2 to 5 inclusive - Access Core, Web Cockpit, Hardware enqueuing, Optical Scanner and QA (v0.5.0-beta)
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import pytest
|
||||
from httpx import AsyncClient, ASGITransport
|
||||
from app.main import app
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_workstation_status_existente():
|
||||
transport = ASGITransport(app=app)
|
||||
async with AsyncClient(transport=transport, base_url="http://test") as client:
|
||||
response = await client.get("/api/v1/control-posts/workstation/CFT-DESK/status")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["workstation_name"].upper() == "CFT-DESK"
|
||||
assert data["is_control_post"] is True
|
||||
assert data["workstation_id"] == 100001
|
||||
assert len(data["modules"]) > 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_workstation_status_no_registrada():
|
||||
transport = ASGITransport(app=app)
|
||||
async with AsyncClient(transport=transport, base_url="http://test") as client:
|
||||
response = await client.get("/api/v1/control-posts/workstation/TABLET_DESCONOCIDA_999/status")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert data["is_control_post"] is False
|
||||
assert len(data["modules"]) == 0
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_listar_workstations():
|
||||
transport = ASGITransport(app=app)
|
||||
async with AsyncClient(transport=transport, base_url="http://test") as client:
|
||||
response = await client.get("/api/v1/control-posts/workstations")
|
||||
|
||||
assert response.status_code == 200
|
||||
data = response.json()
|
||||
assert isinstance(data, list)
|
||||
nombres = [item["nombre"].upper() for item in data]
|
||||
assert "CFT-DESK" in nombres
|
||||
Reference in New Issue
Block a user