1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/integration-cli/docker_cli_login_test.go
Arnaud Porterie 1cab340c10 Suppress output of TestLoginWithoutTTY
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
2014-12-11 18:05:07 -08:00

31 lines
709 B
Go

package main
import (
"bytes"
"io"
"os/exec"
"testing"
)
func TestLoginWithoutTTY(t *testing.T) {
cmd := exec.Command(dockerBinary, "login")
// create a buffer with text then a new line as a return
buf := bytes.NewBuffer([]byte("buffer test string \n"))
// use a pipe for stdin and manually copy the data so that
// the process does not get the TTY
in, err := cmd.StdinPipe()
if err != nil {
t.Fatal(err)
}
// copy the bytes into the commands stdin along with a new line
go io.Copy(in, buf)
// run the command and block until it's done
if err := cmd.Run(); err == nil {
t.Fatal("Expected non nil err when loginning in & TTY not available")
}
logDone("login - login without TTY")
}