improve capture support in body
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-04-03 12:27:35 +11:00
parent ed0abae016
commit 617aa45c3d
4 changed files with 109 additions and 14 deletions

View File

@@ -90,13 +90,13 @@ func HeaderEquals(testCase *TestCase) (bool, error) {
func BodyContains(testCase *TestCase) (bool, error) {
for k, v := range testCase.Expect.Body.Contains {
fmt.Printf("Body contains check '%s'='%s'\n", k, v)
fmt.Printf("%+v\n", testCase.ResultBodyMap)
//fmt.Printf("Body contains check '%s'='%s'\n", k, v)
//fmt.Printf("%+v\n", testCase.ResultBodyMap)
results := findKey(k, testCase.ResultBodyMap)
if len(results) > 0 {
fmt.Printf("Found key '%s': %v\n", k, results)
fmt.Printf("Test Body.Contains found key '%s'\n", k)
checkFound := false
// search through all the results to see if the expected value is there
@@ -114,7 +114,7 @@ func BodyContains(testCase *TestCase) (bool, error) {
}
} else {
fmt.Printf("Key '%s' not found\n", k)
fmt.Printf("Test Body.Contains failed, expected key '%s' not found\n", k)
}
}
@@ -127,9 +127,9 @@ func BodyHasKeys(testCase *TestCase) (bool, error) {
results := findKey(key, testCase.ResultBodyMap)
if len(results) > 0 {
fmt.Printf("Found key '%s' with values %v\n", key, results)
fmt.Printf("Test Body.HasKeys found expected key '%s'\n", key)
} else {
fmt.Printf("Body HasKeys test failed, expected key '%s' not found\n", key)
fmt.Printf("Test Body.HasKeys failed, expected key '%s' not found\n", key)
return false, nil
}