Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add consumer e2e test for manager-api #830

Closed
wants to merge 13 commits into from
8 changes: 8 additions & 0 deletions api/test/e2e/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ type HttpTestCase struct {
ExpectCode int
ExpectMessage string
ExpectBody string
ExpectJSON map[string]interface{}
ExpectHeaders map[string]string
Sleep time.Duration //ms
}
Expand Down Expand Up @@ -167,4 +168,11 @@ func testCaseCheck(tc HttpTestCase) {
resp.Body().Contains(tc.ExpectBody)
}

//verify result by json
if tc.ExpectJSON != nil {
for key, val := range tc.ExpectJSON {
resp.Status(http.StatusOK).JSON().Object().ContainsKey(key).ValueEqual(key, val)
}
}

}
Loading