94 lines
2.2 KiB
Go
94 lines
2.2 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("667553")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(shopInfo, false))
|
|
}
|
|
|
|
func TestShopCreate(t *testing.T) {
|
|
shopInfo := &ShopInfo{
|
|
ShopID: "667553",
|
|
ShopName: "三里家园店",
|
|
Category: ShopCategoryFruit,
|
|
SecondCategory: ShopCategoryFruitFruit,
|
|
ContactName: "高朋朋",
|
|
ContactPhone: "15869188805",
|
|
ShopAddress: "浙江省杭州市下城区文晖街道三里家园一小区25幢杭州新三里家园农贸市场一层36号",
|
|
ShopLng: 120190237,
|
|
ShopLat: 30301060,
|
|
CoordinateType: CoordinateTypeMars,
|
|
DeliveryServiceCodes: utils.Int2Str(DeliveryServiceCodeRapid),
|
|
BusinessHours: "[{\"beginTime\":\"07:00\",\"endTime\":\"19:30\"}]",
|
|
}
|
|
_, 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)
|
|
}
|