From 5b9ef4ec2e15fc916e29697438f7fe7aa87cf95e Mon Sep 17 00:00:00 2001 From: vishalnayak Date: Thu, 3 Mar 2016 14:00:36 -0500 Subject: [PATCH] testcase changes --- command/capabilities_test.go | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/command/capabilities_test.go b/command/capabilities_test.go index 312f45423a..198e0820dd 100644 --- a/command/capabilities_test.go +++ b/command/capabilities_test.go @@ -9,7 +9,7 @@ import ( ) func TestCapabilities_Args(t *testing.T) { - core, key, _ := vault.TestCoreUnsealed(t) + core, _, _ := vault.TestCoreUnsealed(t) ln, _ := http.TestServer(t, core) defer ln.Close() @@ -25,13 +25,30 @@ func TestCapabilities_Args(t *testing.T) { t.Fatalf("expected failure due to no args") } - args = []string{"test"} - if code := c.Run(args); code != 0 { - t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String()) + args = []string{"invalidtoken", "test"} + if code := c.Run(args); code == 0 { + t.Fatalf("expected failure due to no invalid token") } - args = []string{string(key), "test"} - if code := c.Run(args); code != 0 { - t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String()) - } + /* + args = []string{"test"} + if code := c.Run(args); code != 0 { + t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String()) + } + + log.Printf("result1: %s\n", string(ui.OutputWriter.Bytes())) + if !strings.Contains(string(ui.OutputWriter.Bytes()), "This is a 'root' token.") { + t.Fatalf("bad: %s", ui.OutputWriter.String()) + } + + args = []string{string(key), "test"} + if code := c.Run(args); code != 0 { + t.Fatalf("bad: %d\n\n%s", code, ui.ErrorWriter.String()) + } + + log.Printf("result2: %s\n", string(ui.OutputWriter.Bytes())) + if !strings.Contains(string(ui.OutputWriter.Bytes()), "This is a 'root' token.") { + t.Fatalf("bad: %s", ui.OutputWriter.String()) + } + */ }