mirror of
https://github.com/hashicorp/vault.git
synced 2026-06-04 06:15:02 -04:00
testcase changes
This commit is contained in:
parent
42a7bab69e
commit
5b9ef4ec2e
1 changed files with 25 additions and 8 deletions
|
|
@ -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())
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue