- mtwmapi
This commit is contained in:
69
platformapi/mtwmapi/retail_test.go
Normal file
69
platformapi/mtwmapi/retail_test.go
Normal file
@@ -0,0 +1,69 @@
|
||||
package mtwmapi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
func TestRetailCatList(t *testing.T) {
|
||||
result, err := api.RetailCatList(testPoiCode)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestRetailCatUpdate(t *testing.T) {
|
||||
// err := api.RetailCatUpdate(testPoiCode, "测试一级类别", "测试一级类别2", "", 2)
|
||||
err := api.RetailCatUpdate(testPoiCode, "测试一级类别", "测试一级类别", "", 2)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestRetailCatDelete(t *testing.T) {
|
||||
var err error
|
||||
err = api.RetailCatDelete(testPoiCode, utils.GetUpperUUID())
|
||||
if err == nil {
|
||||
t.Fatal("should return error that can not find such cat")
|
||||
}
|
||||
uniqueCatName := "一二三四五六七八九十"
|
||||
// uniqueCatName := "1234567890" //fmt.Sprintf("CAT%d", time.Now().Unix())
|
||||
err = api.RetailCatUpdate(testPoiCode, "", uniqueCatName, "", 15)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
err = api.RetailCatDelete(testPoiCode, uniqueCatName)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRetailList(t *testing.T) {
|
||||
result, err := api.RetailList(testPoiCode, 0, GeneralMaxLimit)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Fatal("should have items")
|
||||
}
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestRetailGetSpTagIds(t *testing.T) {
|
||||
result, err := api.RetailGetSpTagIds()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Fatal("should have items")
|
||||
}
|
||||
// t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestRetailCatSkuBatchDelete(t *testing.T) {
|
||||
err := api.RetailCatSkuBatchDelete(testPoiCode, []string{"测试一级类别"}, nil, nil)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user