85 lines
2.0 KiB
Go
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("800268")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(shopInfo, false))
|
|
}
|
|
|
|
func TestShopCreate(t *testing.T) {
|
|
shopInfo := &ShopInfo{
|
|
ShopID: "800268",
|
|
ShopName: "手可摘鲜果店",
|
|
Category: ShopCategoryFruit,
|
|
SecondCategory: ShopCategoryFruitFruit,
|
|
ContactName: "李廷杰",
|
|
ContactPhone: "15828509674",
|
|
ShopAddress: "四川省成都市双流县华阳街道南湖大道279号",
|
|
ShopLng: 104051308,
|
|
ShopLat: 30490037,
|
|
CoordinateType: CoordinateTypeMars,
|
|
DeliveryServiceCodes: utils.Int2Str(DeliveryServiceCodeRapid),
|
|
BusinessHours: "[{\"beginTime\":\"09:00\",\"endTime\":\"22: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)
|
|
}
|