- ebai api
This commit is contained in:
73
platformapi/ebaiapi/shop_sku_test.go
Normal file
73
platformapi/ebaiapi/shop_sku_test.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package ebaiapi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
func TestShopCategoryCreate(t *testing.T) {
|
||||
result, err := api.ShopCategoryCreate(testShopID, 0, "绿色蔬菜", 16, "16")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
}
|
||||
|
||||
func TestShopCategoryGet(t *testing.T) {
|
||||
result, err := api.ShopCategoryGet(testShopID)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
}
|
||||
|
||||
func TestShopCategoryUpdate(t *testing.T) {
|
||||
err := api.ShopCategoryUpdate(testShopID, 153760204017121, "水果2", 2, "2")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestShopCategoryDelete(t *testing.T) {
|
||||
err := api.ShopCategoryDelete(testShopID, 153760195017120)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSkuGetItemsByCategoryId(t *testing.T) {
|
||||
result, err := api.SkuGetItemsByCategoryId(testShopID, 0)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
}
|
||||
|
||||
func TestSkuList(t *testing.T) {
|
||||
result, err := api.SkuList(testShopID, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
}
|
||||
|
||||
func TestSkuCreate(t *testing.T) {
|
||||
result, err := api.SkuCreate(testShopID, map[string]interface{}{
|
||||
"name": "测试商品",
|
||||
"status": SkuStatusOnline,
|
||||
"left_num": MaxLeftNum,
|
||||
"sale_price": 100,
|
||||
"market_price": 100,
|
||||
"custom_sku_id": 1,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user