chore: release server-v1.0.73
Deploy Server / release-deploy-server (push) Successful in 56s

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YZ4DskSRKsSiheQonFtQvx
This commit is contained in:
wangjia
2026-06-21 19:46:30 +08:00
parent 381588826c
commit 13a6777a85
6 changed files with 64 additions and 18 deletions
+17 -2
View File
@@ -204,11 +204,11 @@ func TestStockInHandler_Withdraw(t *testing.T) {
orderID := extractID(w)
makeRequest(r, "PUT", fmt.Sprintf("/api/v1/stock-in/orders/%d/submit", orderID), adminToken, nil)
// 1. 非管理员撤回 → 403
// 1. 操作员撤回「他人(管理员)」的单 → 403
w = makeRequest(r, "PUT", fmt.Sprintf("/api/v1/stock-in/orders/%d/withdraw", orderID), opToken, nil)
assert.Equal(t, http.StatusForbidden, w.Code)
// 2. 管理员撤回 → 200,状态回到 draft
// 2. 管理员撤回任意单 → 200,状态回到 draft
w = makeRequest(r, "PUT", fmt.Sprintf("/api/v1/stock-in/orders/%d/withdraw", orderID), adminToken, nil)
assert.Equal(t, http.StatusOK, w.Code)
w = makeRequest(r, "GET", fmt.Sprintf("/api/v1/stock-in/orders/%d", orderID), adminToken, nil)
@@ -221,6 +221,21 @@ func TestStockInHandler_Withdraw(t *testing.T) {
// 4. 撤回为 draft 后可再次修改并提交
w = makeRequest(r, "PUT", fmt.Sprintf("/api/v1/stock-in/orders/%d/submit", orderID), adminToken, nil)
assert.Equal(t, http.StatusOK, w.Code)
// 5. 操作员撤回「本人」提交的单 → 200(自己发的肯定能撤)
w = makeRequest(r, "POST", "/api/v1/stock-in/orders", opToken, map[string]interface{}{
"warehouse_id": warehouse.ID,
"order_date": time.Now().Format(time.RFC3339),
"items": []map[string]interface{}{
{"product_id": product.ID, "quantity": 3.0},
},
})
ownID := extractID(w)
makeRequest(r, "PUT", fmt.Sprintf("/api/v1/stock-in/orders/%d/submit", ownID), opToken, nil)
w = makeRequest(r, "PUT", fmt.Sprintf("/api/v1/stock-in/orders/%d/withdraw", ownID), opToken, nil)
assert.Equal(t, http.StatusOK, w.Code)
w = makeRequest(r, "GET", fmt.Sprintf("/api/v1/stock-in/orders/%d", ownID), opToken, nil)
assert.Equal(t, "draft", parseResponse(w)["data"].(map[string]interface{})["status"])
}
func TestStockInHandler_GetNotFound(t *testing.T) {