Files
baseapi/platformapi/mtwmapi/poi_test.go
邹宗楠 31a3dce31b 抖店api
2022-09-30 16:15:31 +08:00

168 lines
3.2 KiB
Go

package mtwmapi
import (
"fmt"
"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{"12524795"})
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 := map[string]interface{}{}
//utils.FilterMapNilMembers(utils.Struct2FlatMap(result[0]))
poiParams["name"] = "京西果园·果切·水果捞(金碧园店)"
err := api.PoiSave("9410009", poiParams)
fmt.Println(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("11918886", "菜市800x600.jpg", "http://image.jxc4.com/image/ff8c9443c894bfb4822f7d2f742718df.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("11011885")
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))
}
func TestPoiSettleSave(t *testing.T) {
_, err := api.PoiSettleSave(&PoiSettleSaveParam{
Type: 0,
ApplyInfos: []*ApplyInfo{
&ApplyInfo{
AppPoiCode: "",
SettlementID: 0, //结算ID
MultiPoiBasicInfo: &MultiPoiBasicInfo{
Name: "xxx店",
City: "成都",
},
},
},
})
if err != nil {
t.Fatal(err)
}
// t.Log(utils.Format4Output(priceInfo, false))
}
func TestPoiSettleCategoryList(t *testing.T) {
result, err := api.PoiSettleCategoryList()
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestPoiSettleSettlementList(t *testing.T) {
result, err := api.PoiSettleSettlementList()
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestCommentScore(t *testing.T) {
result, err := api.CommentScore("11182878")
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetBoundList(t *testing.T) {
result, err := api.GetBoundList("15478260")
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}