89 lines
1.9 KiB
Go
89 lines
1.9 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, 153760292217132)
|
|
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, 116, map[string]interface{}{
|
|
"name": "测试商品",
|
|
"status": SkuStatusOnline,
|
|
"left_num": MaxLeftNum,
|
|
"sale_price": 100,
|
|
"market_price": 100,
|
|
"cat1_id": 151301831158987,
|
|
"cat2_id": 15347484581335,
|
|
"cat3_id": 15347484581339,
|
|
"photos": []map[string]interface{}{
|
|
map[string]interface{}{
|
|
"is_master": true,
|
|
"url": "http://image.jx.scaqda.com/8536c76779333f53517006f88ea7174c.jpg?imageView2/1/w/80/h/80",
|
|
},
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
} else {
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
}
|
|
|
|
func TestSkuShopCategoryMap(t *testing.T) {
|
|
err := api.SkuShopCategoryMap(testShopID, 15378849314129969, "153760472317166")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|