feat(cli): vault list/search/code/status/lock
This commit is contained in:
parent
365340b37d
commit
e20033855d
2 changed files with 141 additions and 9 deletions
|
|
@ -216,6 +216,23 @@ func TestParseGetArgs(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestListNamesParsing(t *testing.T) {
|
||||
// bw list items returns JSON; listNames extracts name + id only.
|
||||
js := `[{"id":"1","name":"GitHub","login":{"username":"u"}},{"id":"2","name":"AWS"}]`
|
||||
names := listNames(js)
|
||||
if len(names) != 2 || names[0] != "GitHub (1)" || names[1] != "AWS (2)" {
|
||||
t.Fatalf("listNames = %v", names)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStatusSummaryUnconfigured(t *testing.T) {
|
||||
f := &fakeRunner{out: map[string]string{}} // no creds
|
||||
s := statusSummary(f.run, "emo", "1001")
|
||||
if !strings.Contains(s, "not configured") {
|
||||
t.Fatalf("status = %q", s)
|
||||
}
|
||||
}
|
||||
|
||||
// getValue is the testable core: given a runner + opts, returns the secret value.
|
||||
func TestGetValueFlow(t *testing.T) {
|
||||
f := &fakeRunner{out: map[string]string{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue