tweak output formatting
This commit is contained in:
@@ -102,7 +102,7 @@ func BodyContains(testCase *TestCase) (bool, error) {
|
||||
// search through all the results to see if the expected value is there
|
||||
for i := range results {
|
||||
if strings.Contains(results[i].(string), v) {
|
||||
fmt.Printf("Expected value of '%s' matches, success\n", v)
|
||||
fmt.Printf("Expected value of '%s' matches\n", v)
|
||||
checkFound = true
|
||||
break
|
||||
}
|
||||
@@ -123,13 +123,25 @@ func BodyContains(testCase *TestCase) (bool, error) {
|
||||
|
||||
func BodyHasKeys(testCase *TestCase) (bool, error) {
|
||||
for _, key := range testCase.Expect.Body.HasKeys {
|
||||
// If the body response was json then we stored it already when running the test
|
||||
if _, ok := testCase.ResultBodyMap[key]; ok {
|
||||
//fmt.Printf("Confirmed body has key '%s'\n", key)
|
||||
|
||||
results := findKey(key, testCase.ResultBodyMap)
|
||||
|
||||
if len(results) > 0 {
|
||||
fmt.Printf("Found key '%s' with values %v\n", key, results)
|
||||
} else {
|
||||
fmt.Printf("Body HasKeys test failed, expected key '%s' not found\n", key)
|
||||
return false, nil
|
||||
}
|
||||
|
||||
/*
|
||||
// If the body response was json then we stored it already when running the test
|
||||
if _, ok := testCase.ResultBodyMap[key]; ok {
|
||||
//fmt.Printf("Confirmed body has key '%s'\n", key)
|
||||
} else {
|
||||
fmt.Printf("Body HasKeys test failed, expected key '%s' not found\n", key)
|
||||
return false, nil
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return true, nil
|
||||
|
Reference in New Issue
Block a user