提交 17d627c8 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

not to print no-cases msg, if login failed

上级 c0230f57
......@@ -2,7 +2,7 @@ Version = 1
Language = zh
Url = http://zentaopms.ngtesting.com/
Account = admin
Password = P2ssw0rd1
Password = P2ssw0rd
Javascript =
Lua =
Perl =
......
......@@ -236,7 +236,7 @@
},
{
"id": "no_cases",
"translation": "No test cases found."
"translation": "No test cases."
},
{
......
......@@ -230,7 +230,7 @@
},
{
"id": "no_cases",
"translation": "未发现测试用例。"
"translation": "未找到测试用例。"
},
{
"id": "success_to_login",
......
......@@ -29,7 +29,7 @@ func Generate(productId string, moduleId string, suiteId string, taskId string,
return
}
cases := zentaoService.LoadTestCases(productId, moduleId, suiteId, taskId)
cases, loginFail := zentaoService.LoadTestCases(productId, moduleId, suiteId, taskId)
if cases != nil && len(cases) > 0 {
productId = cases[0].Product
......@@ -62,6 +62,8 @@ func Generate(productId string, moduleId string, suiteId string, taskId string,
logUtils.PrintToWithColor(err.Error(), color.FgRed)
}
} else {
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("no_cases"), color.FgRed)
if !loginFail {
logUtils.PrintToWithColor(i118Utils.I118Prt.Sprintf("no_cases"), color.FgRed)
}
}
}
......@@ -199,7 +199,9 @@ func PostStr(url string, params map[string]string) (msg string, ok bool) {
jsonErr := json.Unmarshal(bodyStr, &bodyJson)
if jsonErr != nil {
if vari.Verbose {
logUtils.PrintToCmd(jsonErr.Error(), color.FgRed)
if strings.Index(url, "login") == -1 { // ignore jsonErr caused by login request return a html
logUtils.PrintToCmd(jsonErr.Error(), color.FgRed)
}
}
ok = false
return
......
......@@ -19,14 +19,13 @@ import (
"strings"
)
func LoadTestCases(productIdStr, moduleIdStr, suiteIdStr, taskIdStr string) []model.TestCase {
func LoadTestCases(productIdStr, moduleIdStr, suiteIdStr, taskIdStr string) (testcases []model.TestCase, loginFail bool) {
config := configUtils.ReadCurrConfig()
var testcases []model.TestCase
ok := Login(config.Url, config.Account, config.Password)
if !ok {
return testcases
loginFail = true
return
}
if moduleIdStr != "" {
......@@ -41,7 +40,7 @@ func LoadTestCases(productIdStr, moduleIdStr, suiteIdStr, taskIdStr string) []mo
logUtils.PrintUsage()
}
return testcases
return
}
func ListCaseByProduct(baseUrl string, productId string) []model.TestCase {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册