test/helpers: include error return when route fails
This commit is contained in:
parent
5c019cd092
commit
cf53e6a9e2
1 changed files with 2 additions and 2 deletions
|
|
@ -108,11 +108,11 @@ func TestRoute(t *testing.T, api API, external bool, method, path, body string,
|
||||||
t.Skip("This test is for internal testing only")
|
t.Skip("This test is for internal testing only")
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Equalf(t, expectedStatus, resp.StatusCode, "SendHTTP failed for path %s", path)
|
|
||||||
|
|
||||||
replyJSON, err := ioutil.ReadAll(resp.Body)
|
replyJSON, err := ioutil.ReadAll(resp.Body)
|
||||||
require.NoErrorf(t, err, "%s: could not read response body", path)
|
require.NoErrorf(t, err, "%s: could not read response body", path)
|
||||||
|
|
||||||
|
assert.Equalf(t, expectedStatus, resp.StatusCode, "SendHTTP failed for path %s: %v", path, string(replyJSON))
|
||||||
|
|
||||||
if expectedJSON == "" {
|
if expectedJSON == "" {
|
||||||
require.Lenf(t, replyJSON, 0, "%s: expected no response body, but got:\n%s", path, replyJSON)
|
require.Lenf(t, replyJSON, 0, "%s: expected no response body, but got:\n%s", path, replyJSON)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue