Return remote API errors as JSON
Signed-off-by: Ben Firshman <ben@firshman.co.uk> Upstream-commit: 322e2a7d059a81617b593cf6ece2cfd9f6d4ea03 Component: engine
This commit is contained in:
@ -16,9 +16,10 @@ func (s *DockerSuite) TestAuthApi(c *check.C) {
|
||||
Password: "no-password",
|
||||
}
|
||||
|
||||
expected := "Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password\n"
|
||||
expected := "Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password"
|
||||
status, body, err := sockRequest("POST", "/auth", config)
|
||||
c.Assert(err, check.IsNil)
|
||||
c.Assert(status, check.Equals, http.StatusUnauthorized)
|
||||
c.Assert(string(body), checker.Contains, expected, check.Commentf("Expected: %v, got: %v", expected, string(body)))
|
||||
msg := getErrorMessage(c, body)
|
||||
c.Assert(msg, checker.Contains, expected, check.Commentf("Expected: %v, got: %v", expected, msg))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user