test(resources): 删除保护 - 更新单素材引用断言

This commit is contained in:
ddCat
2026-09-24 00:08:38 +08:00
parent 72703d9b66
commit 10c8e19d94

View File

@@ -107,7 +107,7 @@ func TestAssetBatchDeleteHTTP(t *testing.T) {
}
assertAssets(1)
// The existing DELETE endpoint uses the same purge policy for non-archived assets.
// The DELETE endpoint protects referenced assets just like batch deletion.
resource := model.Resource{ID: "single-resource", UserID: "batch-user", Provider: "unsupported-test-provider", ObjectKey: "single.png"}
payload := `{"url":"/api/resources/single-resource/file"}`
for _, record := range []any{
@@ -119,8 +119,8 @@ func TestAssetBatchDeleteHTTP(t *testing.T) {
t.Fatal(err)
}
}
if w := call(http.MethodDelete, "/api/assets/single", "", true); w.Code != http.StatusOK {
if w := call(http.MethodDelete, "/api/assets/single", "", true); w.Code != http.StatusBadRequest {
t.Fatalf("single referenced delete: %d %s", w.Code, w.Body.String())
}
assertAssets(1)
assertAssets(2)
}