Files
baseapi/platformapi/ebaiapi/store_page_test.go
suyl 6d74ea55a1 aa
2021-05-14 16:33:25 +08:00

228 lines
5.8 KiB
Go

package ebaiapi
import (
"fmt"
"net/http"
"testing"
"git.rosy.net.cn/baseapi"
"git.rosy.net.cn/baseapi/utils"
)
func TestGetRealMobileNumber4Order(t *testing.T) {
orderId := "5025796789378554068"
desiredMobile := "18483673654"
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 := "5025796789378554068"
// desiredMobile := "18483673654"
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("2019-02-14 13:00:00", "2019-02-14 15:30:00", "", -1)
if err != nil {
t.Fatal(err)
}
if true {
baseapi.SugarLogger.Debug(utils.Format4Output(orderInfoList, false))
baseapi.SugarLogger.Debug(len(orderInfoList))
}
}
func TestGetEleCommentList(t *testing.T) {
commentList, err := api.GetEleCommentList(utils.Str2Time("2019-09-29 00:00:00"), utils.Str2Time("2019-09-30 23:30:00"), "", "", ReplyStatusAll, CommentLevelAll, CommentContentAll)
if err != nil {
t.Fatal(err)
}
if true {
baseapi.SugarLogger.Debug(utils.Format4Output(commentList, false))
baseapi.SugarLogger.Debug(len(commentList))
}
}
func TestPageGetSkuList(t *testing.T) {
skuList, err := api.PageGetSkuList(32267350915)
if err != nil {
t.Fatal(err)
}
if true {
baseapi.SugarLogger.Debug(utils.Format4Output(skuList, false))
}
}
func TestPageGetCustomSkuList(t *testing.T) {
skuList, err := api.PageGetCustomSkuList(2267121521, 1552729500062)
if err != nil {
t.Fatal(err)
}
if true {
baseapi.SugarLogger.Debug(utils.Format4Output(skuList, false))
}
}
func TestPageGetCustomCatList(t *testing.T) {
catList, err := api.PageGetCustomCatList(2233065941)
if err != nil {
t.Fatal(err)
}
if true {
baseapi.SugarLogger.Debug(utils.Format4Output(catList, false))
}
}
func TestSwitchShop(t *testing.T) {
cookie, err := api.SwitchShop(2233065941)
if err != nil {
t.Fatal(err)
}
t.Log(cookie)
}
func TestGetShopUserInfo(t *testing.T) {
result, err := api.GetShopUserInfo(32267034127)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetShopHealthByDetail(t *testing.T) {
result, err := api.GetShopHealthByDetail(32267034127)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetStoreList(t *testing.T) {
result, err := api.GetStoreList("104.057218", "30.6949", 0, 0)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetStoreList2(t *testing.T) {
result, err := api.GetStoreList2(104.010554, 30.637072)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetStoreInfo(t *testing.T) {
result, err := api.GetStoreInfo("170879219")
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetStoreInfo2(t *testing.T) {
result, err := api.GetStoreInfo2("2233065925")
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetShopListIDs(t *testing.T) {
result, total, _ := api.GetShopListByPage(1, 10, 500, 1)
fmt.Println(total)
for _, v := range result {
fmt.Println(v.Name, v.Wid)
}
}
func TestGetStoresShowWindowSkus(t *testing.T) {
result, _ := api.GetStoresShowWindowSkus(32267089415)
t.Log(utils.Format4Output(result, false))
}
func TestGetExianDaSkuDepot(t *testing.T) {
result, err := api.GetExianDaSkuDepot("190600741")
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetExianDaSku(t *testing.T) {
result, _ := api.GetExianDaSku(100000000000184645)
t.Log(utils.Format4Output(result, false))
}
func TestPageGetSku(t *testing.T) {
result, _ := api.PageGetSku(32267350915, 15813853840796298)
t.Log(utils.Format4Output(result, false))
}
func TestGetEbaiDepotSku(t *testing.T) {
result, _ := api.GetEbaiDepotSku(EbaiWholeCountryStore, "190700570")
t.Log(utils.Format4Output(result, false))
}
func TestGetEbaiSku(t *testing.T) {
result, _ := api.GetEbaiSku("1578500400097", EbaiWholeCountryStore)
t.Log(utils.Format4Output(result, false))
}
func TestGetEbaiShopShareInfo(t *testing.T) {
req, err := http.NewRequest("GET", "https://kong.eleme.cn/h5/C3KHLTXHSEKQ3TGV?_ltraffic_share=clipboard", nil)
req.Header.Set("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9")
req.Header.Set("accept-encoding", "gzip, deflate, br")
req.Header.Set("accept-language", "zh-CN,zh;q=0.9")
req.Header.Set("sec-fetch-user", "?1")
req.Header.Set("sec-fetch-dest", "document")
req.Header.Set("sec-fetch-mode", "navigate")
req.Header.Set("sec-fetch-site", "none")
req.Header.Set("upgrade-insecure-requests", "1")
req.Header.Set("user-agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36")
client := &http.Client{}
res, err := client.Do(req)
fmt.Println(res.Header)
// err := api.GetEbaiShopShareInfo()
if err != nil {
t.Fatal(err)
}
// t.Log(utils.Format4Output(result, false))
}
func TestGetMainActivityList(t *testing.T) {
result, err := api.GetMainActivityList(2233065879)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetMainActivityDetail(t *testing.T) {
result, err := api.GetMainActivityDetail(8134513001)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}
func TestGetSubActivityDetail(t *testing.T) {
result, err := api.GetSubActivityDetail(6136111001)
if err != nil {
t.Fatal(err)
}
t.Log(utils.Format4Output(result, false))
}