mirror of
https://github.com/httprunner/httprunner.git
synced 2026-09-06 16:07:45 +08:00
fix: TestRunCaseWithRefAPI
This commit is contained in:
+16
-1
@@ -293,7 +293,22 @@ func convertCompatValidator(Validators []interface{}) (err error) {
|
|||||||
if _, ok := iValidator.(Validator); ok {
|
if _, ok := iValidator.(Validator); ok {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
validatorMap := iValidator.(map[string]interface{})
|
|
||||||
|
var validatorMap map[string]interface{}
|
||||||
|
if v, ok := iValidator.(map[string]interface{}); ok {
|
||||||
|
validatorMap = v
|
||||||
|
} else if v, ok := iValidator.(map[interface{}]interface{}); ok {
|
||||||
|
// convert map[interface{}]interface{} to map[string]interface{}
|
||||||
|
validatorMap = make(map[string]interface{})
|
||||||
|
for key, value := range v {
|
||||||
|
strKey := fmt.Sprintf("%v", key)
|
||||||
|
validatorMap[strKey] = value
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return errors.Wrap(code.InvalidCaseFormat,
|
||||||
|
fmt.Sprintf("unexpected validator format: %v", iValidator))
|
||||||
|
}
|
||||||
|
|
||||||
validator := Validator{}
|
validator := Validator{}
|
||||||
iCheck, checkExisted := validatorMap["check"]
|
iCheck, checkExisted := validatorMap["check"]
|
||||||
iAssert, assertExisted := validatorMap["assert"]
|
iAssert, assertExisted := validatorMap["assert"]
|
||||||
|
|||||||
Reference in New Issue
Block a user