- mtwmapi
This commit is contained in:
71
platformapi/mtwmapi/poi_test.go
Normal file
71
platformapi/mtwmapi/poi_test.go
Normal file
@@ -0,0 +1,71 @@
|
||||
package mtwmapi
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
testPoiCode = "test_poi_01"
|
||||
)
|
||||
|
||||
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{testPoiCode})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(result) != 1 {
|
||||
t.Fatal("result len is not ok")
|
||||
}
|
||||
if result[0][KeyAppPoiCode] != testPoiCode {
|
||||
t.Fatal("test_poi_01 is not equal")
|
||||
}
|
||||
t.Log(utils.Format4Output(result, false))
|
||||
}
|
||||
|
||||
func TestPoiSave(t *testing.T) {
|
||||
result, err := api.PoiMGet([]string{testPoiCode})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
poiParams := utils.FilterMapNilMembers(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)
|
||||
}
|
||||
Reference in New Issue
Block a user