56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
package jdshopapi
|
|
|
|
import (
|
|
"fmt"
|
|
"io/ioutil"
|
|
"net/http"
|
|
"testing"
|
|
|
|
"git.rosy.net.cn/baseapi/utils"
|
|
)
|
|
|
|
func TestCreateShopCategory(t *testing.T) {
|
|
var CreateShopCategoryParams = []*CreateShopCategoryParam{
|
|
&CreateShopCategoryParam{
|
|
HomeShow: "0",
|
|
ID: "0",
|
|
Open: "",
|
|
OrderNo: "0",
|
|
ParentID: "",
|
|
Title: "测试1",
|
|
Type: "3",
|
|
},
|
|
}
|
|
api.CreateShopCategory(CreateShopCategoryParams)
|
|
}
|
|
|
|
func TestUpdateStoreStatus(t *testing.T) {
|
|
err := api.UpdateStoreStatus(24332466, 1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestNewInfoList(t *testing.T) {
|
|
result, err := api.NewInfoList(1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Log(utils.Format4Output(result, false))
|
|
}
|
|
|
|
func Test11(t *testing.T) {
|
|
request, _ := http.NewRequest(http.MethodGet, "https://stores.shop.jd.com/stores/updateStoreStatus?storeId=24332466&storeStatus=1", nil)
|
|
c := &http.Cookie{
|
|
Name: "thor",
|
|
Value: "80FAF09E9A09B6E618A68057BDFCFCB8C86E8252DC9F7D3B34572625904FBA0AB6BF053A5325612EC0407791BB05F5301356E71E8B282C40C06D0B5DF3439DEECB102A78FAFF7AC0FC4E2D1FA8DD8BBAE1A011E50B5C74F1870AD982D7BF453F470F31F2241B73AC4C25485025C2ABEBC8A538AF7257824D2FAEE300A1435175B0B451FB5C19B78D729FC83152CA3BAF",
|
|
}
|
|
request.AddCookie(c)
|
|
client := &http.Client{}
|
|
fmt.Println("test1", request.URL)
|
|
response, _ := client.Do(request)
|
|
defer response.Body.Close()
|
|
bodyData, _ := ioutil.ReadAll(response.Body)
|
|
fmt.Println("test1", string(bodyData))
|
|
}
|