Changeset View
Changeset View
Standalone View
Standalone View
swh/vault/tests/test_server.py
Show First 20 Lines • Show All 72 Lines • ▼ Show 20 Lines | |||||
async def test_client_index(cli): | async def test_client_index(cli): | ||||
resp = await cli.get("/") | resp = await cli.get("/") | ||||
assert resp.status == 200 | assert resp.status == 200 | ||||
async def test_client_cook_notfound(cli): | async def test_client_cook_notfound(cli): | ||||
resp = await cli.post( | resp = await cli.post( | ||||
"/cook", | "/cook", | ||||
data=json_dumps({"obj_type": "directory", "obj_id": TEST_HEX_ID}), | data=json_dumps({"bundle_type": "directory", "obj_id": TEST_HEX_ID}), | ||||
headers=[("Content-Type", "application/json")], | headers=[("Content-Type", "application/json")], | ||||
) | ) | ||||
assert resp.status == 400 | assert resp.status == 400 | ||||
content = msgpack_loads(await resp.content.read()) | content = msgpack_loads(await resp.content.read()) | ||||
assert content["type"] == "NotFoundExc" | assert content["type"] == "NotFoundExc" | ||||
assert content["args"] == [f"directory {TEST_HEX_ID} was not found."] | assert content["args"] == [f"directory {TEST_HEX_ID} was not found."] | ||||
async def test_client_progress_notfound(cli): | async def test_client_progress_notfound(cli): | ||||
resp = await cli.post( | resp = await cli.post( | ||||
"/progress", | "/progress", | ||||
data=json_dumps({"obj_type": "directory", "obj_id": TEST_HEX_ID}), | data=json_dumps({"bundle_type": "directory", "obj_id": TEST_HEX_ID}), | ||||
headers=[("Content-Type", "application/json")], | headers=[("Content-Type", "application/json")], | ||||
) | ) | ||||
assert resp.status == 400 | assert resp.status == 400 | ||||
content = msgpack_loads(await resp.content.read()) | content = msgpack_loads(await resp.content.read()) | ||||
assert content["type"] == "NotFoundExc" | assert content["type"] == "NotFoundExc" | ||||
assert content["args"] == [f"directory {TEST_HEX_ID} was not found."] | assert content["args"] == [f"directory {TEST_HEX_ID} was not found."] | ||||
▲ Show 20 Lines • Show All 56 Lines • Show Last 20 Lines |