Ejemplo n.º 1
0
func AddCategoryTest() bool {
	//增加测试结果,一个测试写一个
	result.TesDetailResult("AddCategoryTest")
	//case 1
	values := url.Values{
		"Tid":    {""},
		"Name":   {"商品测试类型" + strconv.Itoa(userDate.UserNum)},
		"Pid":    {"0"},
		"Action": {"create"},
		"Sort":   {""},
	}

	callbackDate := &commonFun.ResponseStruct{}
	err, _ := commonFun.HttpUrlFunc("POST", "/createUpdateCategory", values, callbackDate)
	if err != nil {
		log.Println(err)
		return false
	}
	result := commonFun.Expected(callbackDate.Code, 0)
	if result == false {
		return false
	}

	return true
}
Ejemplo n.º 2
0
func CreatStoreCatTest() bool {
	//增加测试结果,一个测试写一个
	result.TesDetailResult("CreatStoreTest")
	//case 1
	assStoreCat := url.Values{}
	assStoreCat.Set("Name", "商店测试类型"+strconv.Itoa(userDate.UserNum))
	callbackDate := &commonFun.ResponseStruct{}
	err, _ := commonFun.HttpUrlFunc("POST", "/storeCat/create", assStoreCat, callbackDate)
	if err != nil {
		log.Println(err)
		return false
	}
	result := commonFun.Expected(callbackDate.Code, 0)
	if result == false {
		return false
	}
	return true
}
Ejemplo n.º 3
0
func LoginTest() bool {
	//增加测试结果,一个测试写一个
	result.TesDetailResult("LoginTest")
	//Login url
	userParam := url.Values{}
	userParam.Set("username", userDate.LoginUserAccounce)
	userParam.Set("password", userDate.LoginUserPassword)
	callbackDate := &commonFun.ResponseStruct{}
	err, _ := commonFun.HttpUrlFunc("POST", "/loginHandle1", userParam, callbackDate)
	if err != nil {
		log.Println("login err", err)
		return false
	}
	result := commonFun.Expected(callbackDate.Code, 0)
	if result == false {
		log.Println("Expected login  fail ", result)
		return false
	}

	return true

}
Ejemplo n.º 4
0
func ProductReleaseTest() bool {

	result.TesDetailResult("ProductReleaseTest")
	//case 1
	err, categoryId := categoryTest.GetCategoryId()
	if err != nil {
		log.Println("get categoryId fail ", err)
		return false
	}
	values := url.Values{
		"sourceName":       {"测试商品" + strconv.Itoa(userDate.UserNum)},
		"sourcePrice":      {"9999.99"},
		"sourceNum":        {"10"},
		"sourceIntro":      {"sourceIntro"},
		"sourceCategory":   {strconv.Itoa(categoryId)},
		"sourcePic":        {"www.pic.com/bmp.jpg"},
		"sourceLogistics":  {"123"},
		"sourceNo":         {"123"},
		"sourceType":       {"123"},
		"sourceDetailType": {"0"},
		"sourceDetailList": {""},
		"sourceWeight":     {"28.88"},
		"sourceLocation":   {"北京|东城"},
		"sourceShowcase":   {"0"},
	}
	resParse := &Resp{}
	err, _ = commonFun.HttpUrlFunc("POST", "/productRelease", values, resParse)
	if err != nil {
		log.Println(err)
		return false
	}
	result := commonFun.Expected(resParse.ErrorCode, 0)
	if result == false {
		return false
	}
	return true
}