e6fd57b9 |
package main
import (
"bytes"
"os/exec" |
dc944ea7 |
|
79498b1c |
"github.com/docker/docker/pkg/integration/checker" |
dc944ea7 |
"github.com/go-check/check" |
e6fd57b9 |
)
|
dc944ea7 |
func (s *DockerSuite) TestLoginWithoutTTY(c *check.C) { |
e6fd57b9 |
cmd := exec.Command(dockerBinary, "login")
|
b8f7526f |
// Send to stdin so the process does not get the TTY
cmd.Stdin = bytes.NewBufferString("buffer test string \n") |
e6fd57b9 |
// run the command and block until it's done |
79498b1c |
err := cmd.Run() |
75bc0c06 |
c.Assert(err, checker.NotNil) //"Expected non nil err when loginning in & TTY not available" |
011b4f01 |
}
|
1b5c2e1d |
func (s *DockerRegistryAuthHtpasswdSuite) TestLoginToPrivateRegistry(c *check.C) { |
011b4f01 |
// wrong credentials |
aee260d4 |
out, _, err := dockerCmdWithError("login", "-u", s.reg.username, "-p", "WRONGPASSWORD", privateRegistryURL)
c.Assert(err, checker.NotNil, check.Commentf(out))
c.Assert(out, checker.Contains, "401 Unauthorized")
// now it's fine
dockerCmd(c, "login", "-u", s.reg.username, "-p", s.reg.password, privateRegistryURL)
}
|
1b5c2e1d |
func (s *DockerRegistryAuthHtpasswdSuite) TestLoginToPrivateRegistryDeprecatedEmailFlag(c *check.C) { |
aee260d4 |
// Test to make sure login still works with the deprecated -e and --email flags
// wrong credentials |
011b4f01 |
out, _, err := dockerCmdWithError("login", "-u", s.reg.username, "-p", "WRONGPASSWORD", "-e", s.reg.email, privateRegistryURL)
c.Assert(err, checker.NotNil, check.Commentf(out))
c.Assert(out, checker.Contains, "401 Unauthorized") |
e6fd57b9 |
|
011b4f01 |
// now it's fine |
aee260d4 |
// -e flag |
011b4f01 |
dockerCmd(c, "login", "-u", s.reg.username, "-p", s.reg.password, "-e", s.reg.email, privateRegistryURL) |
aee260d4 |
// --email flag
dockerCmd(c, "login", "-u", s.reg.username, "-p", s.reg.password, "--email", s.reg.email, privateRegistryURL) |
e6fd57b9 |
} |