P2-2部署尝试+compose通配符修复 / D2收尾(唯一单号+前后断言+H5回归17过) / P2-1 StorefrontAdmin真分页 / 后端511+PG4

This commit is contained in:
seagull
2026-09-13 00:25:50 +08:00
parent eef7be7258
commit e0e1430e8d
10 changed files with 319 additions and 33 deletions
+31
View File
@@ -389,6 +389,37 @@ def test_admin_orders_list_default_submitted(db, auth_client, pro_plan, tenant,
assert orders[0]["id"] == o1.id
def test_admin_orders_pagination(db, auth_client, pro_plan, tenant, account,
products, granted, warehouse):
"""P2-1:admin_orders 支持 page/page_size 翻页,count 为过滤后总数。"""
ids = []
for _ in range(3):
o = sf_services.submit_order(
account.customer,
lines=[{"product_id": products["P001"].id, "quantity": 1}],
)
ids.append(o.id)
p1 = auth_client.get(
"/api/v1/storefront/admin/orders/",
{"status": "submitted", "page": 1, "page_size": 2},
)
assert p1.status_code == 200, p1.content
b1 = p1.json()
assert b1["count"] == 3
assert len(b1["results"]) == 2
p2 = auth_client.get(
"/api/v1/storefront/admin/orders/",
{"status": "submitted", "page": 2, "page_size": 2},
)
assert p2.status_code == 200, p2.content
b2 = p2.json()
assert b2["count"] == 3
assert len(b2["results"]) == 1
# 两页无重叠
got = {r["id"] for r in b1["results"]} | {r["id"] for r in b2["results"]}
assert got == set(ids)
def test_admin_confirm_twice_rejected(db, auth_client, pro_plan, tenant, account,
products, granted, warehouse):
order = sf_services.submit_order(