Files
baseapi/platformapi/mtpsapi/shop_test.go
苏尹岚 e106a982a1 aa
2021-02-23 16:07:46 +08:00

85 lines
2.0 KiB
Go

package mtpsapi
import (
"testing"
"git.rosy.net.cn/baseapi/utils"
)
func TestSimulateShopStatus(t *testing.T) {
err := api.SimulateShopStatus("1", ShopStatusAuditRejected)
if err != nil {
t.Fatal(err)
}
}
func TestShopQuery(t *testing.T) {
// shopInfo, err := api.ShopQuery("not exist")
// if err == nil {
// t.Fatal("应该报错找不到门店")
// }
shopInfo, err := api.ShopQuery("667018")
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(shopInfo, false))
}
func TestShopCreate(t *testing.T) {
shopInfo := &ShopInfo{
ShopID: "11726346",
ShopName: "测试门店",
Category: ShopCategoryFruit,
SecondCategory: ShopCategoryFruitFruit,
ContactName: "徐",
ContactPhone: "18180948107",
ShopAddress: "北京市通州区五所南路与玉桥西路南延交叉口北100米梨园农副产品交易中心 水果区",
ShopLng: 116672496,
ShopLat: 39879491,
CoordinateType: CoordinateTypeMars,
DeliveryServiceCodes: utils.Int2Str(DeliveryServiceCodeRapid),
BusinessHours: "[{\"beginTime\":\"09:00\",\"endTime\":\"18:00\"}]",
}
_, err := api.ShopCreate(shopInfo)
if err != nil {
t.Fatal(err)
}
}
func TestShopUpdate(t *testing.T) {
shopInfo := &ShopInfo{
ShopID: "667018",
ShopLng: 113015935,
ShopLat: 25776427,
}
_, err := api.ShopUpdate(shopInfo)
if err != nil {
t.Fatal(err)
}
}
func TestSimulateArrange(t *testing.T) {
err := api.SimulateArrange(123456789, "1529387562097059")
handleError(t, err)
}
func TestSimulatePickup(t *testing.T) {
err := api.SimulatePickup(123456789, "1529387562097059")
handleError(t, err)
}
func TestSimulateRearrange(t *testing.T) {
err := api.SimulateRearrange(123456789, "1529387562097059")
handleError(t, err)
}
func TestSimulateDeliver(t *testing.T) {
err := api.SimulateDeliver(123456789, "1529387562097059")
handleError(t, err)
}
func TestSimulateReportException(t *testing.T) {
err := api.SimulateReportException(123456789, "1529387562097059")
handleError(t, err)
}