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 (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/docker/docker/api/types"
|
2018-02-09 13:13:26 -05:00
|
|
|
"github.com/docker/docker/integration/internal/request"
|
|
|
|
"github.com/docker/docker/integration/internal/requirement"
|
2018-03-13 15:28:34 -04:00
|
|
|
"github.com/gotestyourself/gotestyourself/assert"
|
|
|
|
is "github.com/gotestyourself/gotestyourself/assert/cmp"
|
2018-01-30 13:19:20 -05:00
|
|
|
"github.com/gotestyourself/gotestyourself/skip"
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Test case for GitHub 22244
|
|
|
|
func TestLoginFailsWithBadCredentials(t *testing.T) {
|
|
|
|
skip.IfCondition(t, !requirement.HasHubConnectivity(t))
|
|
|
|
|
|
|
|
client := request.NewAPIClient(t)
|
|
|
|
|
|
|
|
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
|
|
|
}
|