116 lines
2.1 KiB
Go
116 lines
2.1 KiB
Go
package mtwmapi
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
)
|
|
|
|
const (
|
|
testPoiCode = "2523687"
|
|
)
|
|
|
|
func TestPoiGetIDs(t *testing.T) {
|
|
result, err := api.PoiGetIDs()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(result) == 0 {
|
|
t.Fatal("should have ids")
|
|
}
|
|
// t.Log(result)
|
|
}
|
|
|
|
func TestPoiMGet(t *testing.T) {
|
|
result, err := api.PoiMGet([]string{"2461723"})
|
|
t.Log(utils.Format4Output(result, false))
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(result) != 1 {
|
|
t.Fatal("result len is not ok")
|
|
}
|
|
if result[0].AppPoiCode != testPoiCode {
|
|
t.Fatal("test_poi_01 is not equal")
|
|
}
|
|
}
|
|
|
|
func TestPoiSave(t *testing.T) {
|
|
result, err := api.PoiMGet([]string{testPoiCode})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
poiParams := utils.FilterMapNilMembers(utils.Struct2FlatMap(result[0]))
|
|
poiParams["name"] = "中国"
|
|
err = api.PoiSave(testPoiCode, poiParams)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestPoiTagList(t *testing.T) {
|
|
result, err := api.PoiTagList(testPoiCode)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(result) == 0 {
|
|
t.Fatal("should have cats")
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestImageUploadByURL(t *testing.T) {
|
|
result, err := api.ImageUploadByURL(testPoiCode, "hello.jpg", "http://image.jxc4.com/56cd1e88ada3660f37548c2d29ea2158.jpg")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(result) == 0 {
|
|
t.Fatal("should have result")
|
|
}
|
|
t.Log(result)
|
|
}
|
|
|
|
func TestPoiStatus(t *testing.T) {
|
|
err := api.PoiOnline("6741258")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
err = api.PoiOpen("6741258")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestPoiShipTimeUpdate(t *testing.T) {
|
|
err := api.PoiShipTimeUpdate("7174130", "00:00-23:00")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
err = api.PoiOpen("6741258")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestPoiOpen(t *testing.T) {
|
|
err := api.PoiOpen("6735933")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestPackagePriceUpdate(t *testing.T) {
|
|
err := api.PackagePriceUpdate("2461723", 1, 50)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestPackagePriceGet(t *testing.T) {
|
|
priceInfo, err := api.PackagePriceGet("2461723")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(priceInfo, false))
|
|
}
|