Use vault views for entry and recycle-bin state
This commit is contained in:
+21
-21
@@ -3606,11 +3606,11 @@ func TestUICreateGroupActionSupportsNestedSubgroups(t *testing.T) {
|
||||
t.Fatalf("createGroupAction() error = %v", err)
|
||||
}
|
||||
|
||||
if got := u.state.Session.(*uiSession).model.ChildGroups([]string{"Root"}); !slices.Equal(got, []string{"Infrastructure"}) {
|
||||
t.Fatalf("ChildGroups(Root) = %v, want [Infrastructure]", got)
|
||||
if got := u.state.Session.(*uiSession).model.ChildGroups([]string{"keepass"}); !slices.Equal(got, []string{"Infrastructure"}) {
|
||||
t.Fatalf("ChildGroups(keepass) = %v, want [Infrastructure]", got)
|
||||
}
|
||||
if got := u.state.Session.(*uiSession).model.ChildGroups([]string{"Root", "Infrastructure"}); !slices.Equal(got, []string{"Prod"}) {
|
||||
t.Fatalf("ChildGroups(Root/Infrastructure) = %v, want [Prod]", got)
|
||||
if got := u.state.Session.(*uiSession).model.ChildGroups([]string{"keepass", "Infrastructure"}); !slices.Equal(got, []string{"Prod"}) {
|
||||
t.Fatalf("ChildGroups(keepass/Infrastructure) = %v, want [Prod]", got)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5125,8 +5125,8 @@ func TestUIAutoEntersSingleVaultRootGroupAndDisplaysSlashRoot(t *testing.T) {
|
||||
t.Fatalf("openVaultAction() error = %v", err)
|
||||
}
|
||||
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"keepass"}) {
|
||||
t.Fatalf("currentPath = %v, want [keepass]", got)
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"Root"}) {
|
||||
t.Fatalf("currentPath = %v, want [Root]", got)
|
||||
}
|
||||
if got := u.displayPath(); len(got) != 0 {
|
||||
t.Fatalf("displayPath() = %v, want root slash path", got)
|
||||
@@ -5152,8 +5152,8 @@ func TestUIAutoEntersSingleVaultRootWhenRecycleBinAlsoExists(t *testing.T) {
|
||||
|
||||
u.showEntriesSection()
|
||||
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"keepass"}) {
|
||||
t.Fatalf("currentPath = %v, want [keepass]", got)
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"Root"}) {
|
||||
t.Fatalf("currentPath = %v, want [Root]", got)
|
||||
}
|
||||
if got := u.displayPath(); len(got) != 0 {
|
||||
t.Fatalf("displayPath() = %v, want root slash path", got)
|
||||
@@ -5174,15 +5174,15 @@ func TestUIShowEntriesSectionRestoresHiddenRootAfterLeavingEntries(t *testing.T)
|
||||
})
|
||||
|
||||
u.showEntriesSection()
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"keepass"}) {
|
||||
t.Fatalf("currentPath after initial entries section = %v, want [keepass]", got)
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"Root"}) {
|
||||
t.Fatalf("currentPath after initial entries section = %v, want [Root]", got)
|
||||
}
|
||||
|
||||
u.showAPITokensSection()
|
||||
u.showEntriesSection()
|
||||
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"keepass"}) {
|
||||
t.Fatalf("currentPath after returning to entries = %v, want [keepass]", got)
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"Root"}) {
|
||||
t.Fatalf("currentPath after returning to entries = %v, want [Root]", got)
|
||||
}
|
||||
if got := u.displayPath(); len(got) != 0 {
|
||||
t.Fatalf("displayPath() after returning to entries = %v, want root slash path", got)
|
||||
@@ -5215,8 +5215,8 @@ func TestUISyncCurrentPathNormalizesHiddenRootAfterSectionSwitch(t *testing.T) {
|
||||
|
||||
u.syncCurrentPath()
|
||||
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"keepass"}) {
|
||||
t.Fatalf("currentPath after syncCurrentPath() = %v, want [keepass]", got)
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"Root"}) {
|
||||
t.Fatalf("currentPath after syncCurrentPath() = %v, want [Root]", got)
|
||||
}
|
||||
if got := u.displayPath(); len(got) != 0 {
|
||||
t.Fatalf("displayPath() after syncCurrentPath() = %v, want root slash path", got)
|
||||
@@ -5235,7 +5235,7 @@ func TestUIShowEntriesSectionRestoresEntriesViewState(t *testing.T) {
|
||||
})
|
||||
|
||||
u.showEntriesSection()
|
||||
u.setCurrentPath([]string{"keepass", "Crew", "Internet"})
|
||||
u.setCurrentPath([]string{"Root", "Crew", "Internet"})
|
||||
u.search.SetText("amazon")
|
||||
u.filter()
|
||||
u.state.SelectedEntryID = "amazon"
|
||||
@@ -5245,8 +5245,8 @@ func TestUIShowEntriesSectionRestoresEntriesViewState(t *testing.T) {
|
||||
u.showAPITokensSection()
|
||||
u.showEntriesSection()
|
||||
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"keepass", "Crew", "Internet"}) {
|
||||
t.Fatalf("currentPath after returning to entries = %v, want [keepass Crew Internet]", got)
|
||||
if got := u.currentPath; !slices.Equal(got, []string{"Root", "Crew", "Internet"}) {
|
||||
t.Fatalf("currentPath after returning to entries = %v, want [Root Crew Internet]", got)
|
||||
}
|
||||
if got := u.search.Text(); got != "amazon" {
|
||||
t.Fatalf("search text after returning to entries = %q, want amazon", got)
|
||||
@@ -8073,7 +8073,7 @@ func TestUISelectedRemoteCardUsesLocalCacheSummaryForBoundRemote(t *testing.T) {
|
||||
wantDetails := []string{
|
||||
"/vaults/cache",
|
||||
"Sync target: home.kdbx · dav.example.invalid",
|
||||
"Last group: Root / Internet",
|
||||
"Last group: Internet",
|
||||
}
|
||||
if !slices.Equal(gotDetails, wantDetails) {
|
||||
t.Fatalf("selectedRemoteCardDetailLines() = %v, want %v", gotDetails, wantDetails)
|
||||
@@ -8105,7 +8105,7 @@ func TestUISelectedRemoteCardUsesConnectionSummaryWithoutLocalCache(t *testing.T
|
||||
wantDetails := []string{
|
||||
"Path: vaults/home.kdbx",
|
||||
"Server: https://dav.example.invalid",
|
||||
"Last group: Root / Internet",
|
||||
"Last group: Internet",
|
||||
}
|
||||
if !slices.Equal(gotDetails, wantDetails) {
|
||||
t.Fatalf("selectedRemoteCardDetailLines() = %v, want %v", gotDetails, wantDetails)
|
||||
@@ -9327,8 +9327,8 @@ func TestUIAPIPolicyTargetActionsUseCurrentContext(t *testing.T) {
|
||||
if err := u.useCurrentGroupForPolicyAction(); err != nil {
|
||||
t.Fatalf("useCurrentGroupForPolicyAction() error = %v", err)
|
||||
}
|
||||
if got := u.apiPolicyPath.Text(); got != "bashertarr" {
|
||||
t.Fatalf("apiPolicyPath.Text() = %q, want %q", got, "bashertarr")
|
||||
if got := u.apiPolicyPath.Text(); got != "Crew / bashertarr" {
|
||||
t.Fatalf("apiPolicyPath.Text() = %q, want %q", got, "Crew / bashertarr")
|
||||
}
|
||||
if !u.apiPolicyGroupScopeW.Value {
|
||||
t.Fatal("apiPolicyGroupScopeW.Value = false, want true")
|
||||
|
||||
Reference in New Issue
Block a user