open-vault/command/auth_test.go

42 lines
601 B
Go
Raw Normal View History

2015-03-29 23:42:45 +00:00
package command
import (
"testing"
"github.com/mitchellh/cli"
)
func TestAuth_argsWithMethod(t *testing.T) {
ui := new(cli.MockUi)
c := &AuthCommand{
Meta: Meta{
Ui: ui,
},
}
args := []string{
"-method=foo",
"bar",
}
if code := c.Run(args); code != 1 {
t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String())
}
}
func TestAuth_tooManyArgs(t *testing.T) {
ui := new(cli.MockUi)
c := &AuthCommand{
Meta: Meta{
Ui: ui,
},
}
args := []string{
"foo",
"bar",
}
if code := c.Run(args); code != 1 {
t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String())
}
}