95 lines
2.3 KiB
Go
95 lines
2.3 KiB
Go
package mtpsapi
|
|
|
|
import (
|
|
"fmt"
|
|
"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("11733038")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(shopInfo, false))
|
|
}
|
|
|
|
func TestShopCreate(t *testing.T) {
|
|
shopInfo := &ShopInfo{
|
|
ShopID: "668840",
|
|
ShopName: "创新百货(和泰家园店)",
|
|
Category: ShopCategoryMarket,
|
|
SecondCategory: ShopCategoryMarketConvenience,
|
|
ContactName: "店主",
|
|
ContactPhone: "13101061593",
|
|
ShopAddress: "重庆市渝北区龙溪街道红锦大道68号",
|
|
ShopLng: 106557092,
|
|
ShopLat: 29784067,
|
|
CoordinateType: CoordinateTypeMars,
|
|
DeliveryServiceCodes: utils.Int2Str(DeliveryServiceCodeRapid),
|
|
BusinessHours: "[{\"beginTime\":\"07:00\",\"endTime\":\"23:59\"}]",
|
|
}
|
|
_, err := api.ShopCreate(shopInfo)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestShopUpdate(t *testing.T) {
|
|
shopInfo := &ShopInfo{
|
|
ShopID: "667071",
|
|
ShopLng: 117122952,
|
|
ShopLat: 34244733,
|
|
ShopAddress: "徐州市泉山区临湖路与乐雅路湖西雅苑C区6栋扎堆地酒店对面",
|
|
}
|
|
_, 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)
|
|
}
|
|
|
|
func TestName(t *testing.T) {
|
|
ShopLat := 3030106
|
|
if ShopLat <= 9999999 {
|
|
ShopLat *= 10
|
|
}
|
|
fmt.Println(ShopLat)
|
|
}
|