2018-02-05 16:05:59 -05:00
|
|
|
package system // import "github.com/docker/docker/integration/system"
|
2018-01-30 13:19:20 -05:00
|
|
|
|
|
|
|
import (
|
2018-04-19 18:30:59 -04:00
|
|
|
"context"
|
2018-01-30 13:19:20 -05:00
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
2018-02-09 13:13:26 -05:00
|
|
|
"github.com/docker/docker/integration/internal/requirement"
|
2018-06-11 09:32:11 -04:00
|
|
|
"gotest.tools/assert"
|
|
|
|
is "gotest.tools/assert/cmp"
|
|
|
|
"gotest.tools/skip"
|
2018-01-30 13:19:20 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// Test case for GitHub 22244
|
|
|
|
func TestLoginFailsWithBadCredentials(t *testing.T) {
|
2018-06-11 09:32:11 -04:00
|
|
|
skip.If(t, !requirement.HasHubConnectivity(t))
|
2018-01-30 13:19:20 -05:00
|
|
|
|
2019-01-02 08:16:25 -05:00
|
|
|
defer setupTest(t)()
|
|
|
|
client := testEnv.APIClient()
|
2018-01-30 13:19:20 -05:00
|
|
|
|
|
|
|
config := types.AuthConfig{
|
|
|
|
Username: "no-user",
|
|
|
|
Password: "no-password",
|
|
|
|
}
|
|
|
|
_, err := client.RegistryLogin(context.Background(), config)
|
|
|
|
expected := "Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password"
|
2018-03-13 15:28:34 -04:00
|
|
|
assert.Check(t, is.Error(err, expected))
|
2018-01-30 13:19:20 -05:00
|
|
|
}
|