1
This commit is contained in:
@@ -93,15 +93,36 @@ func TestRetailCatDelete(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRetailList(t *testing.T) {
|
||||
result, err := api.RetailList("785527", 1, 100)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
offset := 0
|
||||
skus := make(map[string]string, 0)
|
||||
for {
|
||||
result, err := api.RetailList("17211186", offset, 100)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Fatal("should have items")
|
||||
}
|
||||
|
||||
for _, v := range result {
|
||||
if v.SkuList != nil && len(v.SkuList) > 0 {
|
||||
for _, v2 := range v.SkuList {
|
||||
mapSkuList := utils.Struct2MapByJson(v2)
|
||||
if mapSkuList["upc"].(string) != "" {
|
||||
skus[mapSkuList["upc"].(string)] = mapSkuList["price"].(string)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(result) < 100 {
|
||||
break
|
||||
}
|
||||
offset++
|
||||
}
|
||||
if len(result) == 0 {
|
||||
t.Fatal("should have items")
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
t.Log(len(result))
|
||||
|
||||
t.Log(utils.Format4Output(skus, false))
|
||||
t.Log(utils.Format4Output(len(skus), false))
|
||||
}
|
||||
|
||||
func TestRetailGet(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user