feat: lazysecrets list marks starred and recent entries, and --starred-icon shows the stars
This commit is contained in:
5 files changed
+74
-3
No files matched your search
@@ -223,3 +223,31 @@ func TestErrorsAreOneLine(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestListMarks(t *testing.T) {
|
||||
t.Parallel()
|
||||
az := fake.Azure(0)
|
||||
var starredLink string
|
||||
got, _, _ := run(t, Options{Providers: []provider.Provider{az}, MaxAge: time.Minute, Kinds: []string{"secret"},
|
||||
Mark: func(link, account string) (bool, bool) {
|
||||
if starredLink == "" && strings.HasSuffix(link, "/db-password") {
|
||||
starredLink = link
|
||||
}
|
||||
return link == starredLink && account == az.ID(), strings.HasSuffix(link, "/api-key")
|
||||
}})
|
||||
var starred, recent int
|
||||
for _, e := range got {
|
||||
if e.Starred {
|
||||
starred++
|
||||
if e.Link != starredLink {
|
||||
t.Errorf("%s starred", e.Link)
|
||||
}
|
||||
}
|
||||
if e.Recent {
|
||||
recent++
|
||||
}
|
||||
}
|
||||
if starred != 1 || recent == 0 {
|
||||
t.Errorf("%d starred, %d recent", starred, recent)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user