From 1ccf891cf249240fc784aaa737f40fb77f5602c8 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 7 Apr 2015 14:22:18 -0700 Subject: [PATCH] command/token-create: test --- command/token_create_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 command/token_create_test.go diff --git a/command/token_create_test.go b/command/token_create_test.go new file mode 100644 index 0000000000..2b659165c5 --- /dev/null +++ b/command/token_create_test.go @@ -0,0 +1,30 @@ +package command + +import ( + "testing" + + "github.com/hashicorp/vault/http" + "github.com/hashicorp/vault/vault" + "github.com/mitchellh/cli" +) + +func TestTokenCreate(t *testing.T) { + core, _, token := vault.TestCoreUnsealed(t) + ln, addr := http.TestServer(t, core) + defer ln.Close() + + ui := new(cli.MockUi) + c := &TokenCreateCommand{ + Meta: Meta{ + ClientToken: token, + Ui: ui, + }, + } + + args := []string{ + "-address", addr, + } + if code := c.Run(args); code != 0 { + t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String()) + } +}