Files
baseapi/platformapi/ebaiapi/shop_sku_test.go
2018-09-22 23:28:32 +08:00

74 lines
1.5 KiB
Go

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))
}
}