test(cloud): the public menu carries each product's allergens (contract C-2, platform-v2 step 6.3)
The snapshot is stored as the site sends it, so `allergens` {key: contains | may_contain}
reaches GET /api/menu/{site} for the QR menu and the order app without a cloud change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -126,3 +126,17 @@ def test_order_numbers_per_site_and_tracking_by_token(client, admin_h):
|
|||||||
assert tj["lines"] == [{"name": "Cola 1.5L", "quantity": 2, "unit_price": 2.5, "options": []}] and tj["order_type"] == "takeaway"
|
assert tj["lines"] == [{"name": "Cola 1.5L", "quantity": 2, "unit_price": 2.5, "options": []}] and tj["order_type"] == "takeaway"
|
||||||
assert client.get("/api/orders/status/ORD-0001").status_code == 404 # ambiguous now
|
assert client.get("/api/orders/status/ORD-0001").status_code == 404 # ambiguous now
|
||||||
assert client.get("/api/orders/track/nope").status_code == 404
|
assert client.get("/api/orders/track/nope").status_code == 404
|
||||||
|
|
||||||
|
|
||||||
|
def test_the_public_menu_carries_each_products_allergens(client, admin_h):
|
||||||
|
"""Plan step 6.3 (contract C-2): the site sends `allergens` {key: contains | may_contain} per
|
||||||
|
product; the public menu passes them to the QR menu and the order app as they are."""
|
||||||
|
site = _new_site(client, admin_h)
|
||||||
|
numeric = _heartbeat(client, site)["site_numeric_id"]
|
||||||
|
snap = {"categories": [{"id": 1, "name": "All", "products": [
|
||||||
|
{"id": PIE, "name": "Pie", "base_price": 5.0, "digital_price": 5.0, "digital_available": True,
|
||||||
|
"sold_at": ["qr_table"], "prices": {"qr_table": 5.0}, "quick_options": [],
|
||||||
|
"allergens": {"gluten": "contains", "sesame": "may_contain"}}]}], "ordering": ORDERING, "timezone": "Europe/Athens"}
|
||||||
|
assert client.post("/api/menu/sync", headers=_h(site), json={"site_id": numeric, "snapshot_json": json.dumps(snap)}).status_code == 200
|
||||||
|
menu = client.get(f"/api/menu/{site['site_id']}").json()
|
||||||
|
assert menu["categories"][0]["products"][0]["allergens"] == {"gluten": "contains", "sesame": "may_contain"}
|
||||||
|
|||||||
Reference in New Issue
Block a user