docker_cli_login_test.go 451 B

123456789101112131415161718192021
  1. package main
  2. import (
  3. "bytes"
  4. "os/exec"
  5. "github.com/go-check/check"
  6. )
  7. func (s *DockerSuite) TestLoginWithoutTTY(c *check.C) {
  8. cmd := exec.Command(dockerBinary, "login")
  9. // Send to stdin so the process does not get the TTY
  10. cmd.Stdin = bytes.NewBufferString("buffer test string \n")
  11. // run the command and block until it's done
  12. if err := cmd.Run(); err == nil {
  13. c.Fatal("Expected non nil err when loginning in & TTY not available")
  14. }
  15. }