""" 发货模块测试 —— /api/shipping """ import uuid import pytest from httpx import AsyncClient class TestShipping: async def test_list_shipping(self, client: AsyncClient, admin_headers): """发货单列表 → 200""" resp = await client.get("/api/shipping", headers=admin_headers) assert resp.status_code == 200 data = resp.json()["data"] assert "total" in data async def test_get_shipping_by_nonexistent_order(self, client: AsyncClient, admin_headers): """不存在的订单发货轨迹 → 200(空列表) 或 404""" fake_id = uuid.uuid4() resp = await client.get(f"/api/shipping/order/{fake_id}", headers=admin_headers) assert resp.status_code in (200, 404)