github.com/webwurst/docker@v1.7.0/integration-cli/docker_cli_login_test.go (about)

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