def test_create_tool(client):
    r = client.post("/api/tools", json={"nom": "Bêche", "categorie": "beche"})
    assert r.status_code == 201
    assert r.json()["nom"] == "Bêche"


def test_list_tools(client):
    client.post("/api/tools", json={"nom": "Outil1"})
    r = client.get("/api/tools")
    assert r.status_code == 200
    assert len(r.json()) >= 1


def test_delete_tool(client):
    r = client.post("/api/tools", json={"nom": "Test"})
    id = r.json()["id"]
    r2 = client.delete(f"/api/tools/{id}")
    assert r2.status_code == 204
