import pytest from fastapi.testclient import TestClient from api.routes import app @pytest.fixture def client(): return TestClient(app) class TestAPIEndpoints: def test_get_status(self, client): response = client.get("/status") assert response.status_code == 200 assert "status" in response.json() def test_get_robot_position(self, client): response = client.get("/robot/position") assert response.status_code == 200 data = response.json() assert "x" in data assert "y" in data assert "z" in data def test_get_slots_status(self, client): response = client.get("/slots") assert response.status_code == 200 slots = response.json() assert isinstance(slots, list) if len(slots) > 0: assert "id" in slots[0] assert "occupied" in slots[0] def test_emergency_stop(self, client): response = client.post("/robot/stop") assert response.status_code == 200 assert response.json()["status"] == "stopped"