31 lines
841 B
Python
31 lines
841 B
Python
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
|
|
|
|
|
|
def test_tool_with_video_url(client):
|
|
r = client.post(
|
|
"/api/tools",
|
|
json={
|
|
"nom": "Tarière",
|
|
"video_url": "/uploads/demo-outil.mp4",
|
|
},
|
|
)
|
|
assert r.status_code == 201
|
|
assert r.json()["video_url"] == "/uploads/demo-outil.mp4"
|