94 lines
2.1 KiB
Go
94 lines
2.1 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: "668752",
|
|
ShopName: "创新百货超市(江津玉观店)",
|
|
Category: ShopCategoryFruit,
|
|
SecondCategory: ShopCategoryFruitFruit,
|
|
ContactName: "店主",
|
|
ContactPhone: "15019883393",
|
|
ShopAddress: "重庆市江津区龙珠街31号附14号",
|
|
ShopLng: 106463489,
|
|
ShopLat: 29316689,
|
|
CoordinateType: CoordinateTypeMars,
|
|
DeliveryServiceCodes: utils.Int2Str(DeliveryServiceCodeRapid),
|
|
BusinessHours: "[{\"beginTime\":\"08:00\",\"endTime\":\"22:0\"}]",
|
|
}
|
|
_, 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)
|
|
}
|
|
|
|
func TestName(t *testing.T) {
|
|
ShopLat := 3030106
|
|
if ShopLat <= 9999999 {
|
|
ShopLat *= 10
|
|
}
|
|
fmt.Println(ShopLat)
|
|
}
|