package jd import ( "testing" "git.rosy.net.cn/jx-callback/business/jxutils/jxcontext" "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" ) func TestCreateSku(t *testing.T) { // t.Log(beego.BConfig.RunMode) skuID := 21741 sku := &model.Sku{} sku.ID = skuID dao.GetEntity(nil, sku) t.Log(sku) // err := CurPurchaseHandler.CreateSku(sku) // if err != nil { // t.Fatal(err.Error()) // } } func TestGetAllCategories(t *testing.T) { result, err := CurPurchaseHandler.GetAllCategories(jxcontext.AdminCtx, "") if err != nil || len(result) == 0 { t.Fatal(err.Error()) } t.Log(utils.Format4Output(result, false)) } // func TestReadSku(t *testing.T) { // skuName, err := CurPurchaseHandler.ReadSku(jxcontext.AdminCtx, "", "2005582952") // t.Log(utils.Format4Output(skuName, false)) // if err != nil { // t.Fatal(err.Error()) // } // if skuName.Name != "味事达酱香鲜特级酿造酱油" || skuName.Skus[0].SpecUnit != "ml" { // t.Fatal("ReadSku return data wrong") // t.Log(string(utils.MustMarshal(skuName))) // } // } func TestGetVendorCategories(t *testing.T) { catList, err := CurPurchaseHandler.GetVendorCategories(jxcontext.AdminCtx) if err != nil { t.Fatal(err.Error()) } t.Log(utils.Format4Output(catList, false)) } func TestGetSkus(t *testing.T) { skuNameList, err := CurPurchaseHandler.GetSkus(jxcontext.AdminCtx, "", 0, "2023747677") t.Log(utils.Format4Output(skuNameList, false)) t.Log(len(skuNameList)) if err != nil { t.Fatal(err.Error()) } }