github.com/pritambaral/docker@v1.4.2-0.20150120174542-b2fe1b3dd952/integration-cli/docker_cli_login_test.go (about)

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