github.com/dinever/docker@v1.11.1/integration-cli/docker_api_auth_test.go (about) 1 package main 2 3 import ( 4 "net/http" 5 6 "github.com/docker/docker/pkg/integration/checker" 7 "github.com/docker/engine-api/types" 8 "github.com/go-check/check" 9 ) 10 11 // Test case for #22244 12 func (s *DockerSuite) TestAuthApi(c *check.C) { 13 config := types.AuthConfig{ 14 Username: "no-user", 15 Password: "no-password", 16 } 17 18 expected := "Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password\n" 19 status, body, err := sockRequest("POST", "/auth", config) 20 c.Assert(err, check.IsNil) 21 c.Assert(status, check.Equals, http.StatusUnauthorized) 22 c.Assert(string(body), checker.Contains, expected, check.Commentf("Expected: %v, got: %v", expected, string(body))) 23 }