fix: send the docker force query parameter as a string

The aiohttp URL builder only accepts strings, ints and floats as query
values and raises a TypeError on a Python bool, so deleting an image
answered a 500. Send true/false like the controller does.
This commit is contained in:
YueGuobin committed 2026-11-06 14:31:26 +08:00
1 parent c1e03194d3
commit 54cfcef6e2
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -341,7 +341,9 @@ async def test_delete_image():
with asyncio_patch("gns3server.compute.docker.Docker.query") as mock:
await docker.delete_image("ubuntu:latest", force=True)
mock.assert_called_with("DELETE", "images/ubuntu:latest", params={"force": True})
# the daemon query string only accepts strings, ints and floats: a
# Python bool would make the aiohttp URL builder raise a TypeError
mock.assert_called_with("DELETE", "images/ubuntu:latest", params={"force": "true"})
# deleting the image drops the id translation recorded for a previous sync
assert docker.image_id_translation("ubuntu:latest") is None