feat: show who an Azure account signs in as, in Details on its row
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
5355c65284
commit
2e941102a2
7 files changed
+151
-3
No files matched your search
@@ -1069,3 +1069,33 @@ func lastLines(scr string, n int) string {
|
||||
lines := strings.Split(strings.TrimRight(scr, "\n"), "\n")
|
||||
return strings.Join(lines[max(0, len(lines)-n):], "\n")
|
||||
}
|
||||
|
||||
// described is an account that can say who it is.
|
||||
type described struct{ provider.Provider }
|
||||
|
||||
func (described) Account() (provider.Account, bool) {
|
||||
return provider.Account{
|
||||
Fields: []provider.Attr{{Label: "name", Value: "Alice Example"}, {Label: "object ID", Value: "oid-123"}},
|
||||
Copy: "oid-123", CopyLabel: "object ID",
|
||||
}, true
|
||||
}
|
||||
|
||||
func TestAccountInDetails(t *testing.T) {
|
||||
t.Parallel()
|
||||
d := newDriver(t, described{fake.Azure(0)})
|
||||
d.keys("g") // the group's row
|
||||
if r, _ := d.m.sources.Selected(); r.kind != rowGroup {
|
||||
t.Fatalf("not on the group: %+v", r)
|
||||
}
|
||||
if scr := d.screen(); !strings.Contains(scr, "Alice Example") || !strings.Contains(scr, "oid-123") {
|
||||
t.Errorf("account not in Details:\n%s", scr)
|
||||
}
|
||||
d.keys("y")
|
||||
if got := d.clip().content; got != "oid-123" {
|
||||
t.Errorf("y copied %q", got)
|
||||
}
|
||||
d.keys("j")
|
||||
if strings.Contains(d.screen(), "Alice Example") {
|
||||
t.Errorf("still shown on a subscription:\n%s", d.screen())
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user