27 lines
894 B
Python
27 lines
894 B
Python
import pytest
|
|
from httpx import AsyncClient
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_tool_definition_crud(auth_client: AsyncClient) -> None:
|
|
resp = await auth_client.post(
|
|
"/api/v1/tool-definitions",
|
|
json={"key": "runfusion", "name": "RunFusion", "image": "runfusion:latest"},
|
|
)
|
|
assert resp.status_code == 201
|
|
td_id = resp.json()["id"]
|
|
|
|
resp = await auth_client.get("/api/v1/tool-definitions")
|
|
assert resp.status_code == 200
|
|
assert len(resp.json()) >= 1
|
|
|
|
resp = await auth_client.get(f"/api/v1/tool-definitions/{td_id}")
|
|
assert resp.status_code == 200
|
|
|
|
resp = await auth_client.put(f"/api/v1/tool-definitions/{td_id}", json={"name": "RunFusionV2"})
|
|
assert resp.status_code == 200
|
|
assert resp.json()["name"] == "RunFusionV2"
|
|
|
|
resp = await auth_client.delete(f"/api/v1/tool-definitions/{td_id}")
|
|
assert resp.status_code == 204
|