104 lines
2.3 KiB
Go
104 lines
2.3 KiB
Go
package jdapi
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"git.rosy.net.cn/baseapi"
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
)
|
|
|
|
func TestGetRealMobileNumber4Order(t *testing.T) {
|
|
orderId := "910170516000941"
|
|
desiredMobile := "13398196274"
|
|
mobile, err := api.GetRealMobile4Order(orderId, "")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if mobile != desiredMobile {
|
|
t.Fatalf("orderId:%s's mobile is wrong, should be %s, but it's:%s", orderId, desiredMobile, mobile)
|
|
}
|
|
baseapi.SugarLogger.Debug(mobile)
|
|
}
|
|
|
|
func TestGetStoreOrderInfo(t *testing.T) {
|
|
orderId := "910170516000941"
|
|
orderInfo, err := api.GetStoreOrderInfo(orderId, "")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
baseapi.SugarLogger.Debug(utils.Format4Output(orderInfo, false))
|
|
}
|
|
|
|
func TestGetStoreOrderInfoList(t *testing.T) {
|
|
orderInfoList, err := api.GetStoreOrderInfoList("2018-05-01 12:00:00", "2018-05-01 12:59:59")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if true {
|
|
baseapi.SugarLogger.Debug(utils.Format4Output(orderInfoList, false))
|
|
}
|
|
}
|
|
|
|
func TestGetSkuPageInfo(t *testing.T) {
|
|
skuInfo, err := api.GetSkuPageInfo(2023524346)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
baseapi.SugarLogger.Debug(utils.Format4Output(skuInfo, false))
|
|
}
|
|
|
|
func TestGetSkuPageImageInfo(t *testing.T) {
|
|
imgList, err := api.GetSkuPageImageInfo(2025112058)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
baseapi.SugarLogger.Debug(utils.Format4Output(imgList, false))
|
|
}
|
|
|
|
func TestGetCorporationInfo(t *testing.T) {
|
|
imgList, err := api.GetCorporationInfo("", "915101003431062533")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
baseapi.SugarLogger.Debug(utils.Format4Output(imgList, false))
|
|
}
|
|
|
|
func TestGetStoreList(t *testing.T) {
|
|
result, err := api.GetStoreList("104.054195", "30.581782")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestGetStoreInfo(t *testing.T) {
|
|
result, err := api.GetStoreInfo("11750116")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestGetStoreInfo2(t *testing.T) {
|
|
result, err := api.GetStoreInfo2("11883852")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func TestMonthSaleNum2Int(t *testing.T) {
|
|
num1 := MonthSaleNum2Int("1千+")
|
|
if num1 != 1000 {
|
|
t.Fatalf("num1:%d", num1)
|
|
}
|
|
num2 := MonthSaleNum2Int("2万+")
|
|
if num2 != 20000 {
|
|
t.Fatalf("num2:%d", num2)
|
|
}
|
|
num3 := MonthSaleNum2Int("234")
|
|
if num3 != 234 {
|
|
t.Fatalf("num3:%d", num3)
|
|
}
|
|
}
|