github.com/rita33cool1/iot-system-gateway@v0.0.0-20200911033302-e65bde238cc5/docker-engine/integration/system/login_test.go (about) 1 package system // import "github.com/docker/docker/integration/system" 2 3 import ( 4 "testing" 5 6 "github.com/docker/docker/api/types" 7 "github.com/docker/docker/integration/internal/request" 8 "github.com/docker/docker/integration/internal/requirement" 9 "github.com/gotestyourself/gotestyourself/assert" 10 is "github.com/gotestyourself/gotestyourself/assert/cmp" 11 "github.com/gotestyourself/gotestyourself/skip" 12 "golang.org/x/net/context" 13 ) 14 15 // Test case for GitHub 22244 16 func TestLoginFailsWithBadCredentials(t *testing.T) { 17 skip.IfCondition(t, !requirement.HasHubConnectivity(t)) 18 19 client := request.NewAPIClient(t) 20 21 config := types.AuthConfig{ 22 Username: "no-user", 23 Password: "no-password", 24 } 25 _, err := client.RegistryLogin(context.Background(), config) 26 expected := "Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password" 27 assert.Check(t, is.Error(err, expected)) 28 }