2016-04-22 23:00:47 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2016-09-06 14:18:12 -04:00
|
|
|
"github.com/docker/docker/api/types"
|
2017-05-23 23:56:26 -04:00
|
|
|
"github.com/docker/docker/client"
|
2016-12-30 12:23:00 -05:00
|
|
|
"github.com/docker/docker/integration-cli/checker"
|
2016-04-22 23:00:47 -04:00
|
|
|
"github.com/go-check/check"
|
2017-05-23 23:56:26 -04:00
|
|
|
"golang.org/x/net/context"
|
2016-04-22 23:00:47 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
// Test case for #22244
|
[nit] integration-cli: obey Go's naming convention
No substantial code change.
- Api --> API
- Cli --> CLI
- Http, Https --> HTTP, HTTPS
- Id --> ID
- Uid,Gid,Pid --> UID,PID,PID
- Ipam --> IPAM
- Tls --> TLS (TestDaemonNoTlsCliTlsVerifyWithEnv --> TestDaemonTLSVerifyIssue13964)
Didn't touch in this commit:
- Git: because it is officially "Git": https://git-scm.com/
- Tar: because it is officially "Tar": https://www.gnu.org/software/tar/
- Cpu, Nat, Mac, Ipc, Shm: for keeping a consistency with existing production code (not changable, for compatibility)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2016-09-27 21:50:12 -04:00
|
|
|
func (s *DockerSuite) TestAuthAPI(c *check.C) {
|
2016-04-25 13:17:17 -04:00
|
|
|
testRequires(c, Network)
|
2016-04-22 23:00:47 -04:00
|
|
|
config := types.AuthConfig{
|
|
|
|
Username: "no-user",
|
|
|
|
Password: "no-password",
|
|
|
|
}
|
2017-05-23 23:56:26 -04:00
|
|
|
cli, err := client.NewEnvClient()
|
|
|
|
c.Assert(err, checker.IsNil)
|
|
|
|
defer cli.Close()
|
2016-04-22 23:00:47 -04:00
|
|
|
|
2017-05-23 23:56:26 -04:00
|
|
|
_, err = cli.RegistryLogin(context.Background(), config)
|
2016-05-21 07:56:04 -04:00
|
|
|
expected := "Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password"
|
2017-05-23 23:56:26 -04:00
|
|
|
c.Assert(err.Error(), checker.Contains, expected)
|
2016-04-22 23:00:47 -04:00
|
|
|
}
|