Files
baseapi/platformapi/ebaiapi/shop_test.go
2020-08-26 09:06:24 +08:00

150 lines
3.0 KiB
Go

package ebaiapi
import (
"testing"
"git.rosy.net.cn/baseapi/utils"
)
func TestShopList(t *testing.T) {
result, err := api.ShopList(SysStatusAll)
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestShopCreate(t *testing.T) {
result, err := api.ShopCreate(map[string]interface{}{
"shop_id": "123123123",
"business_form_id": "179",
"service_phone": "1111111",
"invoice_support": "2",
"package_box_price": "0",
"encrypt": "",
"category1": "",
"category2": "",
"category3": "",
"name": "测试",
"supplier_id": "2233065879",
})
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestShopGet(t *testing.T) {
result, err := api.ShopGet("", 32267697558) //2233065879
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
// result, err = api.ShopGet(testShopID, 0)
// if err != nil {
// t.Fatal(err)
// } else {
// t.Log(utils.Format4Output(result, false))
// }
}
func TestShopAptitudeGet(t *testing.T) {
result, err := api.ShopAptitudeGet("", testShopBaiduID)
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestShopUpdate(t *testing.T) {
params := map[string]interface{}{
KeyName: "好菜鲜生-测试店",
KeyPhone: "13812345678",
KeyBaiduShopID: testShopBaiduID,
"longitude": 116.307884,
"latitude": 40.036828,
"coord_type": "amap",
"province": "131",
"city": "131",
"county": "1960",
"address": "北京市海淀区上地信息路甲9号",
}
err := api.ShopUpdate(params)
if err != nil {
t.Fatal(err)
} else {
}
}
func TestShopBusStatusGet(t *testing.T) {
result, err := api.ShopBusStatusGet("", testShopBaiduID, PlatformFlagElm)
if err != nil {
t.Fatal(err)
} else {
t.Log(result)
}
}
func TestShopStatusGet(t *testing.T) {
result, err := api.ShopStatusGet("", testShopBaiduID)
if err != nil {
t.Fatal(err)
} else {
t.Log(result)
}
}
func TestShopIDBatchUpdate(t *testing.T) {
err := api.ShopIDBatchUpdate([]string{utils.Int2Str(testShopBaiduID)}, []string{"100077"})
if err != nil {
t.Fatal(err)
}
// err = api.ShopIDBatchUpdate([]string{utils.Int2Str(testShopBaiduID)}, []string{testShopID})
// if err != nil {
// t.Fatal(err)
// }
}
func TestSupplierList(t *testing.T) {
result, err := api.SupplierList()
if err != nil {
t.Fatal(err)
} else {
t.Log(utils.Format4Output(result, false))
}
}
func TestShopOpen(t *testing.T) {
err := api.ShopOpen("", testShopBaiduID)
if err != nil {
t.Fatal(err)
}
}
func TestShopClose(t *testing.T) {
err := api.ShopClose("", testShopBaiduID)
if err != nil {
t.Fatal(err)
}
}
func TestShopOffline(t *testing.T) {
err := api.ShopOffline("", testShopBaiduID)
if err != nil {
t.Fatal(err)
}
}
func TestShopAnnouncementSet(t *testing.T) {
err := api.ShopAnnouncementSet("", testShopBaiduID, "测试公告123")
if err != nil {
t.Fatal(err)
}
}