52 lines
1.5 KiB
Go
52 lines
1.5 KiB
Go
package goods_add
|
|
|
|
import (
|
|
"ai_scheduler/internal/config"
|
|
"context"
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
// Test_Call
|
|
func Test_Call(t *testing.T) {
|
|
req := &GoodsAddRequest{
|
|
Unit: "元",
|
|
IsComposeGoods: 2,
|
|
GoodsAttributes: "<p><span style=\"color: rgb(96, 98, 102); background-color: rgb(255, 255, 255); font-size: 14px;\">商品规格参数</span></p>",
|
|
Introduction: "<p><span style=\"color: rgb(96, 98, 102); background-color: rgb(255, 255, 255); font-size: 14px;\">商品卖点</span></p>",
|
|
GoodsIllustration: "<p><span style=\"color: rgb(96, 98, 102); background-color: rgb(255, 255, 255); font-size: 14px;\">商品说明</span></p>",
|
|
IsHot: 2,
|
|
Title: "fu测试001",
|
|
GoodsNum: "futest001sku",
|
|
SpuCode: "futest001spu",
|
|
SpuName: "fu测试001",
|
|
Price: 100,
|
|
SalesPrice: 80,
|
|
Discount: 15,
|
|
TaxRate: 13,
|
|
FreightId: 3,
|
|
Remark: "备注说明",
|
|
SellByDate: 180,
|
|
ExternalPrice: 120,
|
|
GoodsBarCode: "futest001code2",
|
|
GoodsCode: "futest001code1",
|
|
SellByDateUnit: "天",
|
|
BrandId: 3,
|
|
ExternalUrl: "https://www.baidu.com",
|
|
}
|
|
|
|
cfg := config.ToolConfig{
|
|
BaseURL: "https://gateway.dev.cdlsxd.cn/goods-admin/api/v1/goods/add",
|
|
}
|
|
|
|
client := New(cfg)
|
|
toolResp, err := client.Call(context.Background(), req)
|
|
|
|
if err != nil {
|
|
t.Errorf("Call() error = %v", err)
|
|
return
|
|
}
|
|
|
|
fmt.Printf("toolResp: %v\n", toolResp)
|
|
}
|