feat(server): extend GET /box/info with mixed items and attachment summary
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -226,3 +226,33 @@ def test_attachment_box_delete_cleans_empty_box(client: TestClient, db: Session)
|
||||
},
|
||||
)
|
||||
assert recreated.status_code == 200
|
||||
|
||||
|
||||
def test_box_info_includes_attachment_summary(client: TestClient, db: Session):
|
||||
cert_id, extra_id = _seed(db)
|
||||
client.put(
|
||||
"/CargoTrace/attachment/config",
|
||||
json={
|
||||
"zongpai_no": "26BW0011",
|
||||
"determination": "has",
|
||||
"items": [
|
||||
{"category_id": cert_id, "expected_qty": 80},
|
||||
{"category_id": extra_id, "expected_qty": 5},
|
||||
],
|
||||
},
|
||||
)
|
||||
client.post(
|
||||
"/CargoTrace/attachment/box",
|
||||
json={
|
||||
"zongpai_no": "26BW0011",
|
||||
"category_id": cert_id,
|
||||
"box_no": 951,
|
||||
"quantity": 80,
|
||||
},
|
||||
)
|
||||
info = client.get(
|
||||
"/CargoTrace/box/info", params={"zongpai_no": "26BW0011"}
|
||||
).json()
|
||||
assert info["attachment_summary"]["determination"] == "has"
|
||||
assert info["attachment_summary"]["all_complete"] is False
|
||||
assert info["attachment_summary"]["pending_count"] == 1 # extra not yet boxed
|
||||
|
||||
Reference in New Issue
Block a user