github.com/docker/docker@v299999999.0.0-20200612211812-aaf470eca7b5+incompatible/integration/system/login_test.go (about)

     1  package system // import "github.com/docker/docker/integration/system"
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/docker/docker/api/types"
     8  	"github.com/docker/docker/integration/internal/requirement"
     9  	"gotest.tools/v3/assert"
    10  	is "gotest.tools/v3/assert/cmp"
    11  	"gotest.tools/v3/skip"
    12  )
    13  
    14  // Test case for GitHub 22244
    15  func TestLoginFailsWithBadCredentials(t *testing.T) {
    16  	skip.If(t, !requirement.HasHubConnectivity(t))
    17  
    18  	defer setupTest(t)()
    19  	client := testEnv.APIClient()
    20  
    21  	config := types.AuthConfig{
    22  		Username: "no-user",
    23  		Password: "no-password",
    24  	}
    25  	_, err := client.RegistryLogin(context.Background(), config)
    26  	assert.Assert(t, err != nil)
    27  	assert.Check(t, is.ErrorContains(err, "unauthorized: incorrect username or password"))
    28  	assert.Check(t, is.ErrorContains(err, "https://registry-1.docker.io/v2/"))
    29  }