Retheme remote sync test fixtures

This commit is contained in:
Joe Julian
2026-04-06 22:00:10 -07:00
parent 739d918c21
commit cb6fbd05a3
4 changed files with 256 additions and 256 deletions
+36 -36
View File
@@ -24,18 +24,18 @@ func TestRemoteBindingResolveUsesVaultProfileAndCredentialEntry(t *testing.T) {
}, },
RemoteProfiles: []vault.RemoteProfile{ RemoteProfiles: []vault.RemoteProfile{
{ {
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}, },
}, },
} }
binding := RemoteBinding{ binding := RemoteBinding{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "linuscaldwell-webdav", CredentialEntryID: "linuscaldwell-webdav",
SyncMode: SyncModeAutomaticOnOpenSave, SyncMode: SyncModeAutomaticOnOpenSave,
} }
@@ -47,8 +47,8 @@ func TestRemoteBindingResolveUsesVaultProfileAndCredentialEntry(t *testing.T) {
if got := resolved.Profile.BaseURL; got != "https://dav.example.invalid/remote.php/dav" { if got := resolved.Profile.BaseURL; got != "https://dav.example.invalid/remote.php/dav" {
t.Fatalf("resolved profile base URL = %q, want remote.php/dav URL", got) t.Fatalf("resolved profile base URL = %q, want remote.php/dav URL", got)
} }
if got := resolved.Profile.Path; got != "files/family/keepass.kdbx" { if got := resolved.Profile.Path; got != "files/bellagio/keepass.kdbx" {
t.Fatalf("resolved profile path = %q, want files/family/keepass.kdbx", got) t.Fatalf("resolved profile path = %q, want files/bellagio/keepass.kdbx", got)
} }
if got := resolved.Credentials.Username; got != "linuscaldwell" { if got := resolved.Credentials.Username; got != "linuscaldwell" {
t.Fatalf("resolved credentials username = %q, want linuscaldwell", got) t.Fatalf("resolved credentials username = %q, want linuscaldwell", got)
@@ -68,8 +68,8 @@ func TestRemoteBindingResolveFailsWhenVaultReferenceIsMissing(t *testing.T) {
} }
_, err := (RemoteBinding{ _, err := (RemoteBinding{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "missing-creds", CredentialEntryID: "missing-creds",
}).Resolve(model) }).Resolve(model)
if !errors.Is(err, vault.ErrRemoteProfileNotFound) { if !errors.Is(err, vault.ErrRemoteProfileNotFound) {
@@ -77,16 +77,16 @@ func TestRemoteBindingResolveFailsWhenVaultReferenceIsMissing(t *testing.T) {
} }
model.RemoteProfiles = []vault.RemoteProfile{{ model.RemoteProfiles = []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}} }}
_, err = (RemoteBinding{ _, err = (RemoteBinding{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "missing-creds", CredentialEntryID: "missing-creds",
}).Resolve(model) }).Resolve(model)
if !errors.Is(err, vault.ErrEntryNotFound) { if !errors.Is(err, vault.ErrEntryNotFound) {
@@ -98,8 +98,8 @@ func TestRemoteBindingJSONStoresOnlyNonSecretReferences(t *testing.T) {
t.Parallel() t.Parallel()
content, err := json.Marshal(RemoteBinding{ content, err := json.Marshal(RemoteBinding{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: SyncModeAutomaticOnOpenSave, SyncMode: SyncModeAutomaticOnOpenSave,
}) })
@@ -121,11 +121,11 @@ func TestConfigureRemoteBindingStoresProfileAndCredentialsInVault(t *testing.T)
var model vault.Model var model vault.Model
binding, err := ConfigureRemoteBinding(&model, RemoteBindingInput{ binding, err := ConfigureRemoteBinding(&model, RemoteBindingInput{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
RemoteProfileName: "Family Vault", RemoteProfileName: "Bellagio Vault",
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
RemotePath: "files/family/keepass.kdbx", RemotePath: "files/bellagio/keepass.kdbx",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
CredentialTitle: "Bellagio WebDAV Sign-In", CredentialTitle: "Bellagio WebDAV Sign-In",
Username: "linuscaldwell", Username: "linuscaldwell",
@@ -155,10 +155,10 @@ func TestConfigureRemoteBindingStoresProfileAndCredentialsInVault(t *testing.T)
t.Fatalf("stored credential entry URL = %q, want remote.php/dav URL", credentials.URL) t.Fatalf("stored credential entry URL = %q, want remote.php/dav URL", credentials.URL)
} }
if binding.LocalVaultPath != "/tmp/family.kdbx" { if binding.LocalVaultPath != "/tmp/bellagio.kdbx" {
t.Fatalf("binding LocalVaultPath = %q, want /tmp/family.kdbx", binding.LocalVaultPath) t.Fatalf("binding LocalVaultPath = %q, want /tmp/bellagio.kdbx", binding.LocalVaultPath)
} }
if binding.RemoteProfileID != "family-webdav" || binding.CredentialEntryID != "remote-creds-1" { if binding.RemoteProfileID != "bellagio-webdav" || binding.CredentialEntryID != "remote-creds-1" {
t.Fatalf("binding = %#v, want only vault references", binding) t.Fatalf("binding = %#v, want only vault references", binding)
} }
} }
@@ -173,9 +173,9 @@ func TestConfigureRemoteBindingRejectsIncompleteInput(t *testing.T) {
{ {
name: "missing_local_vault_path", name: "missing_local_vault_path",
input: RemoteBindingInput{ input: RemoteBindingInput{
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
RemotePath: "files/family/keepass.kdbx", RemotePath: "files/bellagio/keepass.kdbx",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
Password: "bellagio-pass-1", Password: "bellagio-pass-1",
}, },
@@ -183,9 +183,9 @@ func TestConfigureRemoteBindingRejectsIncompleteInput(t *testing.T) {
{ {
name: "missing_remote_base_url", name: "missing_remote_base_url",
input: RemoteBindingInput{ input: RemoteBindingInput{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
RemotePath: "files/family/keepass.kdbx", RemotePath: "files/bellagio/keepass.kdbx",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
Password: "bellagio-pass-1", Password: "bellagio-pass-1",
}, },
@@ -193,10 +193,10 @@ func TestConfigureRemoteBindingRejectsIncompleteInput(t *testing.T) {
{ {
name: "missing_credential_entry_id", name: "missing_credential_entry_id",
input: RemoteBindingInput{ input: RemoteBindingInput{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
RemotePath: "files/family/keepass.kdbx", RemotePath: "files/bellagio/keepass.kdbx",
Password: "bellagio-pass-1", Password: "bellagio-pass-1",
}, },
}, },
@@ -224,17 +224,17 @@ func TestRemoveRemoteBindingRemovesProfileAndCredentialsFromVault(t *testing.T)
Password: "bellagio-pass-1", Password: "bellagio-pass-1",
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
} }
err := RemoveRemoteBinding(&model, RemoteBinding{ err := RemoveRemoteBinding(&model, RemoteBinding{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
}) })
if err != nil { if err != nil {
+27 -27
View File
@@ -172,18 +172,18 @@ func TestRemoteProfilesReturnsVaultProfiles(t *testing.T) {
model: vault.Model{ model: vault.Model{
RemoteProfiles: []vault.RemoteProfile{ RemoteProfiles: []vault.RemoteProfile{
{ {
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}, },
{ {
ID: "archive-webdav", ID: "archive-webdav",
Name: "Archive Vault", Name: "Archive Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/archive.kdbx", Path: "files/bellagio/archive.kdbx",
}, },
}, },
}, },
@@ -197,7 +197,7 @@ func TestRemoteProfilesReturnsVaultProfiles(t *testing.T) {
if len(got) != 2 { if len(got) != 2 {
t.Fatalf("len(RemoteProfiles()) = %d, want 2", len(got)) t.Fatalf("len(RemoteProfiles()) = %d, want 2", len(got))
} }
if got[0].ID != "archive-webdav" || got[1].ID != "family-webdav" { if got[0].ID != "archive-webdav" || got[1].ID != "bellagio-webdav" {
t.Fatalf("RemoteProfiles() = %#v, want sorted by name/id", got) t.Fatalf("RemoteProfiles() = %#v, want sorted by name/id", got)
} }
} }
@@ -1045,11 +1045,11 @@ func TestOpenBoundRemoteVaultResolvesClientFromVaultBinding(t *testing.T) {
}, },
RemoteProfiles: []vault.RemoteProfile{ RemoteProfiles: []vault.RemoteProfile{
{ {
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}, },
}, },
}, },
@@ -1062,8 +1062,8 @@ func TestOpenBoundRemoteVaultResolvesClientFromVaultBinding(t *testing.T) {
} }
err := state.OpenBoundRemoteVault(RemoteBinding{ err := state.OpenBoundRemoteVault(RemoteBinding{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: SyncModeAutomaticOnOpenSave, SyncMode: SyncModeAutomaticOnOpenSave,
}, vault.MasterKey{Password: "correct horse battery staple"}) }, vault.MasterKey{Password: "correct horse battery staple"})
@@ -1080,8 +1080,8 @@ func TestOpenBoundRemoteVaultResolvesClientFromVaultBinding(t *testing.T) {
if got := sess.remoteClient.Password; got != "bellagio-pass-1" { if got := sess.remoteClient.Password; got != "bellagio-pass-1" {
t.Fatalf("remote client password = %q, want bellagio-pass-1", got) t.Fatalf("remote client password = %q, want bellagio-pass-1", got)
} }
if got := sess.remotePath; got != "files/family/keepass.kdbx" { if got := sess.remotePath; got != "files/bellagio/keepass.kdbx" {
t.Fatalf("remotePath = %q, want files/family/keepass.kdbx", got) t.Fatalf("remotePath = %q, want files/bellagio/keepass.kdbx", got)
} }
if len(state.CurrentPath) != 0 { if len(state.CurrentPath) != 0 {
t.Fatalf("CurrentPath = %v, want empty", state.CurrentPath) t.Fatalf("CurrentPath = %v, want empty", state.CurrentPath)
@@ -1101,7 +1101,7 @@ func TestOpenBoundRemoteVaultReturnsResolutionErrors(t *testing.T) {
state := State{Session: sess} state := State{Session: sess}
err := state.OpenBoundRemoteVault(RemoteBinding{ err := state.OpenBoundRemoteVault(RemoteBinding{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "missing-profile", RemoteProfileID: "missing-profile",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
}, vault.MasterKey{Password: "correct horse battery staple"}) }, vault.MasterKey{Password: "correct horse battery staple"})
@@ -1117,11 +1117,11 @@ func TestConfigureRemoteBindingPersistsIntoCurrentVaultAndMarksDirty(t *testing.
state := State{Session: sess} state := State{Session: sess}
binding, err := state.ConfigureRemoteBinding(RemoteBindingInput{ binding, err := state.ConfigureRemoteBinding(RemoteBindingInput{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
RemoteProfileName: "Family Vault", RemoteProfileName: "Bellagio Vault",
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
RemotePath: "files/family/keepass.kdbx", RemotePath: "files/bellagio/keepass.kdbx",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
CredentialTitle: "Bellagio WebDAV Sign-In", CredentialTitle: "Bellagio WebDAV Sign-In",
Username: "linuscaldwell", Username: "linuscaldwell",
@@ -1136,8 +1136,8 @@ func TestConfigureRemoteBindingPersistsIntoCurrentVaultAndMarksDirty(t *testing.
if !state.Dirty { if !state.Dirty {
t.Fatal("Dirty = false, want true after ConfigureRemoteBinding") t.Fatal("Dirty = false, want true after ConfigureRemoteBinding")
} }
if got := binding.RemoteProfileID; got != "family-webdav" { if got := binding.RemoteProfileID; got != "bellagio-webdav" {
t.Fatalf("binding.RemoteProfileID = %q, want family-webdav", got) t.Fatalf("binding.RemoteProfileID = %q, want bellagio-webdav", got)
} }
if got := len(sess.model.RemoteProfiles); got != 1 { if got := len(sess.model.RemoteProfiles); got != 1 {
t.Fatalf("len(RemoteProfiles) = %d, want 1", got) t.Fatalf("len(RemoteProfiles) = %d, want 1", got)
@@ -1156,10 +1156,10 @@ func TestConfigureRemoteBindingRequiresMutableSession(t *testing.T) {
state := State{Session: stubSession{model: vault.Model{}}} state := State{Session: stubSession{model: vault.Model{}}}
_, err := state.ConfigureRemoteBinding(RemoteBindingInput{ _, err := state.ConfigureRemoteBinding(RemoteBindingInput{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
RemotePath: "files/family/keepass.kdbx", RemotePath: "files/bellagio/keepass.kdbx",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
Password: "bellagio-pass-1", Password: "bellagio-pass-1",
}) })
@@ -1179,18 +1179,18 @@ func TestRemoveRemoteBindingRemovesVaultDataAndMarksDirty(t *testing.T) {
Password: "bellagio-pass-1", Password: "bellagio-pass-1",
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}} }}
state := State{Session: sess} state := State{Session: sess}
err := state.RemoveRemoteBinding(RemoteBinding{ err := state.RemoveRemoteBinding(RemoteBinding{
LocalVaultPath: "/tmp/family.kdbx", LocalVaultPath: "/tmp/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
}) })
if err != nil { if err != nil {
+186 -186
View File
@@ -222,13 +222,13 @@ func TestUICurrentVaultSummary(t *testing.T) {
t.Parallel() t.Parallel()
u := newUIWithSession("phone", summarySession{hasVault: true}) u := newUIWithSession("phone", summarySession{hasVault: true})
u.vaultPath.SetText("/vaults/family.kdbx") u.vaultPath.SetText("/vaults/bellagio.kdbx")
u.recentVaultGroups["/vaults/family.kdbx"] = []string{"Root", "Internet"} u.recentVaultGroups["/vaults/bellagio.kdbx"] = []string{"Root", "Internet"}
got := u.currentVaultSummary() got := u.currentVaultSummary()
want := vaultSummary{ want := vaultSummary{
Title: "family.kdbx", Title: "bellagio.kdbx",
Detail: "/vaults/family.kdbx", Detail: "/vaults/bellagio.kdbx",
Context: "Resume in: Root / Internet", Context: "Resume in: Root / Internet",
} }
if got != want { if got != want {
@@ -1772,18 +1772,18 @@ func TestUIOpenRemoteActionUsesSelectedVaultBinding(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}, },
} }
u := newUIWithSession("desktop", sess) u := newUIWithSession("desktop", sess)
u.masterPassword.SetText("correct horse battery staple") u.masterPassword.SetText("correct horse battery staple")
u.selectedVaultRemoteProfileID = "family-webdav" u.selectedVaultRemoteProfileID = "bellagio-webdav"
u.selectedVaultRemoteCredentialEntryID = "remote-creds-1" u.selectedVaultRemoteCredentialEntryID = "remote-creds-1"
if err := u.openRemoteAction(); err != nil { if err := u.openRemoteAction(); err != nil {
@@ -1799,13 +1799,13 @@ func TestUIOpenRemoteActionUsesSelectedVaultBinding(t *testing.T) {
if got := sess.remoteClient.Password; got != "bellagio-pass-1" { if got := sess.remoteClient.Password; got != "bellagio-pass-1" {
t.Fatalf("remoteClient.Password = %q, want bellagio-pass-1", got) t.Fatalf("remoteClient.Password = %q, want bellagio-pass-1", got)
} }
if got := sess.remotePath; got != "files/family/keepass.kdbx" { if got := sess.remotePath; got != "files/bellagio/keepass.kdbx" {
t.Fatalf("remotePath = %q, want files/family/keepass.kdbx", got) t.Fatalf("remotePath = %q, want files/bellagio/keepass.kdbx", got)
} }
if got := u.remoteBaseURL.Text(); got != "https://dav.example.invalid/remote.php/dav" { if got := u.remoteBaseURL.Text(); got != "https://dav.example.invalid/remote.php/dav" {
t.Fatalf("remoteBaseURL = %q, want resolved profile base URL", got) t.Fatalf("remoteBaseURL = %q, want resolved profile base URL", got)
} }
if got := u.remotePath.Text(); got != "files/family/keepass.kdbx" { if got := u.remotePath.Text(); got != "files/bellagio/keepass.kdbx" {
t.Fatalf("remotePath editor = %q, want resolved profile path", got) t.Fatalf("remotePath editor = %q, want resolved profile path", got)
} }
} }
@@ -1823,18 +1823,18 @@ func TestUIOpenRemoteActionUsesImplicitSingleVaultBinding(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}, },
} }
u := newUIWithSession("desktop", sess) u := newUIWithSession("desktop", sess)
u.masterPassword.SetText("correct horse battery staple") u.masterPassword.SetText("correct horse battery staple")
u.vaultPath.SetText("/vaults/family.kdbx") u.vaultPath.SetText("/vaults/bellagio.kdbx")
if err := u.openRemoteAction(); err != nil { if err := u.openRemoteAction(); err != nil {
t.Fatalf("openRemoteAction() error = %v", err) t.Fatalf("openRemoteAction() error = %v", err)
@@ -1849,8 +1849,8 @@ func TestUIOpenRemoteActionUsesImplicitSingleVaultBinding(t *testing.T) {
if got := sess.remoteClient.Password; got != "bellagio-pass-1" { if got := sess.remoteClient.Password; got != "bellagio-pass-1" {
t.Fatalf("remoteClient.Password = %q, want bellagio-pass-1", got) t.Fatalf("remoteClient.Password = %q, want bellagio-pass-1", got)
} }
if got := sess.remotePath; got != "files/family/keepass.kdbx" { if got := sess.remotePath; got != "files/bellagio/keepass.kdbx" {
t.Fatalf("remotePath = %q, want files/family/keepass.kdbx", got) t.Fatalf("remotePath = %q, want files/bellagio/keepass.kdbx", got)
} }
} }
@@ -1858,7 +1858,7 @@ func TestUIOpenRemoteActionBootstrapsFromLocalVaultBinding(t *testing.T) {
t.Parallel() t.Parallel()
key := vault.MasterKey{Password: "correct horse battery staple"} key := vault.MasterKey{Password: "correct horse battery staple"}
localPath := filepath.Join(t.TempDir(), "family.kdbx") localPath := filepath.Join(t.TempDir(), "bellagio.kdbx")
remoteModel := vault.Model{ remoteModel := vault.Model{
Entries: []vault.Entry{{ Entries: []vault.Entry{{
@@ -1890,10 +1890,10 @@ func TestUIOpenRemoteActionBootstrapsFromLocalVaultBinding(t *testing.T) {
localModel := vault.Model{} localModel := vault.Model{}
if _, err := appstate.ConfigureRemoteBinding(&localModel, appstate.RemoteBindingInput{ if _, err := appstate.ConfigureRemoteBinding(&localModel, appstate.RemoteBindingInput{
LocalVaultPath: localPath, LocalVaultPath: localPath,
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
RemoteProfileName: "family.kdbx · dav.example.invalid", RemoteProfileName: "bellagio.kdbx · dav.example.invalid",
BaseURL: server.URL, BaseURL: server.URL,
RemotePath: "files/family/keepass.kdbx", RemotePath: "files/bellagio/keepass.kdbx",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
CredentialTitle: "Bellagio WebDAV Sign-In · linuscaldwell", CredentialTitle: "Bellagio WebDAV Sign-In · linuscaldwell",
Username: "linuscaldwell", Username: "linuscaldwell",
@@ -1909,9 +1909,9 @@ func TestUIOpenRemoteActionBootstrapsFromLocalVaultBinding(t *testing.T) {
u.masterPassword.SetText(key.Password) u.masterPassword.SetText(key.Password)
u.applyRecentRemoteRecord(recentRemoteRecord{ u.applyRecentRemoteRecord(recentRemoteRecord{
BaseURL: server.URL, BaseURL: server.URL,
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: localPath, LocalVaultPath: localPath,
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
}) })
@@ -1935,7 +1935,7 @@ func TestUIStartOpenRemoteActionUsesSelectedVaultBinding(t *testing.T) {
t.Parallel() t.Parallel()
localKey := vault.MasterKey{Password: "correct horse battery staple"} localKey := vault.MasterKey{Password: "correct horse battery staple"}
localPath := filepath.Join(t.TempDir(), "family.kdbx") localPath := filepath.Join(t.TempDir(), "bellagio.kdbx")
localModel := vault.Model{ localModel := vault.Model{
Entries: []vault.Entry{{ Entries: []vault.Entry{{
ID: "remote-creds-1", ID: "remote-creds-1",
@@ -1945,11 +1945,11 @@ func TestUIStartOpenRemoteActionUsesSelectedVaultBinding(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "", BaseURL: "",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
} }
@@ -1987,7 +1987,7 @@ func TestUIStartOpenRemoteActionUsesSelectedVaultBinding(t *testing.T) {
u := newUIWithSession("desktop", manager) u := newUIWithSession("desktop", manager)
u.masterPassword.SetText(localKey.Password) u.masterPassword.SetText(localKey.Password)
u.vaultPath.SetText(localPath) u.vaultPath.SetText(localPath)
u.selectedVaultRemoteProfileID = "family-webdav" u.selectedVaultRemoteProfileID = "bellagio-webdav"
u.selectedVaultRemoteCredentialEntryID = "remote-creds-1" u.selectedVaultRemoteCredentialEntryID = "remote-creds-1"
u.startOpenRemoteAction() u.startOpenRemoteAction()
@@ -2001,7 +2001,7 @@ func TestUIStartOpenRemoteActionUsesSelectedVaultBinding(t *testing.T) {
if got := u.remoteBaseURL.Text(); got != server.URL { if got := u.remoteBaseURL.Text(); got != server.URL {
t.Fatalf("remoteBaseURL = %q, want server URL from selected profile", got) t.Fatalf("remoteBaseURL = %q, want server URL from selected profile", got)
} }
if got := u.remotePath.Text(); got != "files/family/keepass.kdbx" { if got := u.remotePath.Text(); got != "files/bellagio/keepass.kdbx" {
t.Fatalf("remotePath = %q, want selected profile path", got) t.Fatalf("remotePath = %q, want selected profile path", got)
} }
} }
@@ -2010,7 +2010,7 @@ func TestUIStartOpenRemoteActionUsesImplicitSingleVaultBinding(t *testing.T) {
t.Parallel() t.Parallel()
localKey := vault.MasterKey{Password: "correct horse battery staple"} localKey := vault.MasterKey{Password: "correct horse battery staple"}
localPath := filepath.Join(t.TempDir(), "family.kdbx") localPath := filepath.Join(t.TempDir(), "bellagio.kdbx")
localModel := vault.Model{ localModel := vault.Model{
Entries: []vault.Entry{{ Entries: []vault.Entry{{
ID: "remote-creds-1", ID: "remote-creds-1",
@@ -2020,11 +2020,11 @@ func TestUIStartOpenRemoteActionUsesImplicitSingleVaultBinding(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "", BaseURL: "",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
} }
@@ -2074,7 +2074,7 @@ func TestUIStartOpenRemoteActionUsesImplicitSingleVaultBinding(t *testing.T) {
if got := u.remoteBaseURL.Text(); got != server.URL { if got := u.remoteBaseURL.Text(); got != server.URL {
t.Fatalf("remoteBaseURL = %q, want server URL from implicit profile", got) t.Fatalf("remoteBaseURL = %q, want server URL from implicit profile", got)
} }
if got := u.remotePath.Text(); got != "files/family/keepass.kdbx" { if got := u.remotePath.Text(); got != "files/bellagio/keepass.kdbx" {
t.Fatalf("remotePath = %q, want implicit profile path", got) t.Fatalf("remotePath = %q, want implicit profile path", got)
} }
} }
@@ -2083,7 +2083,7 @@ func TestUIStartOpenRemoteActionBootstrapsFromLocalVaultBinding(t *testing.T) {
t.Parallel() t.Parallel()
key := vault.MasterKey{Password: "correct horse battery staple"} key := vault.MasterKey{Password: "correct horse battery staple"}
localPath := filepath.Join(t.TempDir(), "family.kdbx") localPath := filepath.Join(t.TempDir(), "bellagio.kdbx")
remoteModel := vault.Model{ remoteModel := vault.Model{
Entries: []vault.Entry{{ Entries: []vault.Entry{{
@@ -2115,10 +2115,10 @@ func TestUIStartOpenRemoteActionBootstrapsFromLocalVaultBinding(t *testing.T) {
localModel := vault.Model{} localModel := vault.Model{}
if _, err := appstate.ConfigureRemoteBinding(&localModel, appstate.RemoteBindingInput{ if _, err := appstate.ConfigureRemoteBinding(&localModel, appstate.RemoteBindingInput{
LocalVaultPath: localPath, LocalVaultPath: localPath,
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
RemoteProfileName: "family.kdbx · dav.example.invalid", RemoteProfileName: "bellagio.kdbx · dav.example.invalid",
BaseURL: server.URL, BaseURL: server.URL,
RemotePath: "files/family/keepass.kdbx", RemotePath: "files/bellagio/keepass.kdbx",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
CredentialTitle: "Bellagio WebDAV Sign-In · linuscaldwell", CredentialTitle: "Bellagio WebDAV Sign-In · linuscaldwell",
Username: "linuscaldwell", Username: "linuscaldwell",
@@ -2135,9 +2135,9 @@ func TestUIStartOpenRemoteActionBootstrapsFromLocalVaultBinding(t *testing.T) {
u.masterPassword.SetText(key.Password) u.masterPassword.SetText(key.Password)
u.applyRecentRemoteRecord(recentRemoteRecord{ u.applyRecentRemoteRecord(recentRemoteRecord{
BaseURL: server.URL, BaseURL: server.URL,
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: localPath, LocalVaultPath: localPath,
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
}) })
@@ -2169,7 +2169,7 @@ func TestUIOpenVaultActionSelectsSoleSavedRemoteBinding(t *testing.T) {
t.Parallel() t.Parallel()
key := vault.MasterKey{Password: "correct horse battery staple"} key := vault.MasterKey{Password: "correct horse battery staple"}
path := filepath.Join(t.TempDir(), "family.kdbx") path := filepath.Join(t.TempDir(), "bellagio.kdbx")
model := vault.Model{ model := vault.Model{
Entries: []vault.Entry{{ Entries: []vault.Entry{{
ID: "remote-creds-1", ID: "remote-creds-1",
@@ -2179,11 +2179,11 @@ func TestUIOpenVaultActionSelectsSoleSavedRemoteBinding(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
} }
writeKDBXMainTestFile(t, path, model, key) writeKDBXMainTestFile(t, path, model, key)
@@ -2196,9 +2196,9 @@ func TestUIOpenVaultActionSelectsSoleSavedRemoteBinding(t *testing.T) {
}) })
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: path, LocalVaultPath: path,
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: string(appstate.SyncModeManual), SyncMode: string(appstate.SyncModeManual),
}} }}
@@ -2213,8 +2213,8 @@ func TestUIOpenVaultActionSelectsSoleSavedRemoteBinding(t *testing.T) {
t.Fatalf("openVaultAction() error = %v", err) t.Fatalf("openVaultAction() error = %v", err)
} }
if got := u.selectedVaultRemoteProfileID; got != "family-webdav" { if got := u.selectedVaultRemoteProfileID; got != "bellagio-webdav" {
t.Fatalf("selectedVaultRemoteProfileID = %q, want family-webdav", got) t.Fatalf("selectedVaultRemoteProfileID = %q, want bellagio-webdav", got)
} }
if got := u.selectedVaultRemoteCredentialEntryID; got != "remote-creds-1" { if got := u.selectedVaultRemoteCredentialEntryID; got != "remote-creds-1" {
t.Fatalf("selectedVaultRemoteCredentialEntryID = %q, want remote-creds-1", got) t.Fatalf("selectedVaultRemoteCredentialEntryID = %q, want remote-creds-1", got)
@@ -2222,7 +2222,7 @@ func TestUIOpenVaultActionSelectsSoleSavedRemoteBinding(t *testing.T) {
if got := u.remoteBaseURL.Text(); got != "https://dav.example.invalid/remote.php/dav" { if got := u.remoteBaseURL.Text(); got != "https://dav.example.invalid/remote.php/dav" {
t.Fatalf("remoteBaseURL = %q, want resolved profile base URL", got) t.Fatalf("remoteBaseURL = %q, want resolved profile base URL", got)
} }
if got := u.remotePath.Text(); got != "files/family/keepass.kdbx" { if got := u.remotePath.Text(); got != "files/bellagio/keepass.kdbx" {
t.Fatalf("remotePath = %q, want resolved profile path", got) t.Fatalf("remotePath = %q, want resolved profile path", got)
} }
if got := u.selectedVaultRemoteSyncMode; got != appstate.SyncModeManual { if got := u.selectedVaultRemoteSyncMode; got != appstate.SyncModeManual {
@@ -2234,7 +2234,7 @@ func TestUIStartOpenVaultActionSelectsSoleSavedRemoteBinding(t *testing.T) {
t.Parallel() t.Parallel()
key := vault.MasterKey{Password: "correct horse battery staple"} key := vault.MasterKey{Password: "correct horse battery staple"}
path := filepath.Join(t.TempDir(), "family.kdbx") path := filepath.Join(t.TempDir(), "bellagio.kdbx")
model := vault.Model{ model := vault.Model{
Entries: []vault.Entry{{ Entries: []vault.Entry{{
ID: "remote-creds-1", ID: "remote-creds-1",
@@ -2244,11 +2244,11 @@ func TestUIStartOpenVaultActionSelectsSoleSavedRemoteBinding(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
} }
writeKDBXMainTestFile(t, path, model, key) writeKDBXMainTestFile(t, path, model, key)
@@ -2274,8 +2274,8 @@ func TestUIStartOpenVaultActionSelectsSoleSavedRemoteBinding(t *testing.T) {
if got := u.state.ErrorMessage; got != "" { if got := u.state.ErrorMessage; got != "" {
t.Fatalf("ErrorMessage after apply = %q, want empty", got) t.Fatalf("ErrorMessage after apply = %q, want empty", got)
} }
if got := u.selectedVaultRemoteProfileID; got != "family-webdav" { if got := u.selectedVaultRemoteProfileID; got != "bellagio-webdav" {
t.Fatalf("selectedVaultRemoteProfileID = %q, want family-webdav", got) t.Fatalf("selectedVaultRemoteProfileID = %q, want bellagio-webdav", got)
} }
if got := u.selectedVaultRemoteCredentialEntryID; got != "remote-creds-1" { if got := u.selectedVaultRemoteCredentialEntryID; got != "remote-creds-1" {
t.Fatalf("selectedVaultRemoteCredentialEntryID = %q, want remote-creds-1", got) t.Fatalf("selectedVaultRemoteCredentialEntryID = %q, want remote-creds-1", got)
@@ -2283,7 +2283,7 @@ func TestUIStartOpenVaultActionSelectsSoleSavedRemoteBinding(t *testing.T) {
if got := u.remoteBaseURL.Text(); got != "https://dav.example.invalid/remote.php/dav" { if got := u.remoteBaseURL.Text(); got != "https://dav.example.invalid/remote.php/dav" {
t.Fatalf("remoteBaseURL = %q, want resolved profile base URL", got) t.Fatalf("remoteBaseURL = %q, want resolved profile base URL", got)
} }
if got := u.remotePath.Text(); got != "files/family/keepass.kdbx" { if got := u.remotePath.Text(); got != "files/bellagio/keepass.kdbx" {
t.Fatalf("remotePath = %q, want resolved profile path", got) t.Fatalf("remotePath = %q, want resolved profile path", got)
} }
} }
@@ -2292,7 +2292,7 @@ func TestUIOpenVaultActionAutomaticallySynchronizesFromRemoteBinding(t *testing.
t.Parallel() t.Parallel()
key := vault.MasterKey{Password: "correct horse battery staple"} key := vault.MasterKey{Password: "correct horse battery staple"}
path := filepath.Join(t.TempDir(), "family.kdbx") path := filepath.Join(t.TempDir(), "bellagio.kdbx")
localModel := vault.Model{ localModel := vault.Model{
Entries: []vault.Entry{{ Entries: []vault.Entry{{
ID: "remote-creds-1", ID: "remote-creds-1",
@@ -2302,11 +2302,11 @@ func TestUIOpenVaultActionAutomaticallySynchronizesFromRemoteBinding(t *testing.
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://stale.example.invalid/remote.php/dav", BaseURL: "https://stale.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
} }
writeKDBXMainTestFile(t, path, localModel, key) writeKDBXMainTestFile(t, path, localModel, key)
@@ -2341,9 +2341,9 @@ func TestUIOpenVaultActionAutomaticallySynchronizesFromRemoteBinding(t *testing.
}) })
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: server.URL, BaseURL: server.URL,
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: path, LocalVaultPath: path,
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: string(appstate.SyncModeAutomaticOnOpenSave), SyncMode: string(appstate.SyncModeAutomaticOnOpenSave),
}} }}
@@ -2370,18 +2370,18 @@ func TestUIOpenVaultActionKeepsLocalVaultOpenWhenAutoSyncFails(t *testing.T) {
t.Parallel() t.Parallel()
key := vault.MasterKey{Password: "correct horse battery staple"} key := vault.MasterKey{Password: "correct horse battery staple"}
path := filepath.Join(t.TempDir(), "family.kdbx") path := filepath.Join(t.TempDir(), "bellagio.kdbx")
localModel := vault.Model{ localModel := vault.Model{
Entries: []vault.Entry{ Entries: []vault.Entry{
{ID: "entry-1", Title: "Local Cache", Path: []string{"Root", "Internet"}}, {ID: "entry-1", Title: "Local Cache", Path: []string{"Root", "Internet"}},
{ID: "remote-creds-1", Title: "Bellagio WebDAV Sign-In", Username: "linuscaldwell", Password: "bellagio-pass-1", Path: []string{"Crew", "Internet"}}, {ID: "remote-creds-1", Title: "Bellagio WebDAV Sign-In", Username: "linuscaldwell", Password: "bellagio-pass-1", Path: []string{"Crew", "Internet"}},
}, },
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://unreachable.example.invalid/remote.php/dav", BaseURL: "https://unreachable.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
} }
writeKDBXMainTestFile(t, path, localModel, key) writeKDBXMainTestFile(t, path, localModel, key)
@@ -2394,9 +2394,9 @@ func TestUIOpenVaultActionKeepsLocalVaultOpenWhenAutoSyncFails(t *testing.T) {
}) })
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: "https://unreachable.example.invalid/remote.php/dav", BaseURL: "https://unreachable.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: path, LocalVaultPath: path,
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: string(appstate.SyncModeAutomaticOnOpenSave), SyncMode: string(appstate.SyncModeAutomaticOnOpenSave),
}} }}
@@ -2426,7 +2426,7 @@ func TestUISaveActionAutomaticallySynchronizesToRemoteBinding(t *testing.T) {
t.Parallel() t.Parallel()
key := vault.MasterKey{Password: "correct horse battery staple"} key := vault.MasterKey{Password: "correct horse battery staple"}
path := filepath.Join(t.TempDir(), "family.kdbx") path := filepath.Join(t.TempDir(), "bellagio.kdbx")
localModel := vault.Model{ localModel := vault.Model{
Entries: []vault.Entry{{ Entries: []vault.Entry{{
ID: "remote-creds-1", ID: "remote-creds-1",
@@ -2436,11 +2436,11 @@ func TestUISaveActionAutomaticallySynchronizesToRemoteBinding(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://stale.example.invalid/remote.php/dav", BaseURL: "https://stale.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
} }
writeKDBXMainTestFile(t, path, localModel, key) writeKDBXMainTestFile(t, path, localModel, key)
@@ -2487,9 +2487,9 @@ func TestUISaveActionAutomaticallySynchronizesToRemoteBinding(t *testing.T) {
}) })
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: server.URL, BaseURL: server.URL,
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: path, LocalVaultPath: path,
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: string(appstate.SyncModeAutomaticOnOpenSave), SyncMode: string(appstate.SyncModeAutomaticOnOpenSave),
}} }}
@@ -2523,7 +2523,7 @@ func TestPickExistingFileOutputExtractsPathFromPortalNoise(t *testing.T) {
output := strings.Join([]string{ output := strings.Join([]string{
"(zenity:1): Gdk-DEBUG: Ignoring portal setting", "(zenity:1): Gdk-DEBUG: Ignoring portal setting",
"/home/tester/vaults/family.kdbx", "/home/tester/vaults/bellagio.kdbx",
"", "",
}, "\n") }, "\n")
@@ -2531,8 +2531,8 @@ func TestPickExistingFileOutputExtractsPathFromPortalNoise(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("parsePickedFilePath() error = %v", err) t.Fatalf("parsePickedFilePath() error = %v", err)
} }
if got != "/home/tester/vaults/family.kdbx" { if got != "/home/tester/vaults/bellagio.kdbx" {
t.Fatalf("parsePickedFilePath() = %q, want /home/tester/vaults/family.kdbx", got) t.Fatalf("parsePickedFilePath() = %q, want /home/tester/vaults/bellagio.kdbx", got)
} }
} }
@@ -4164,9 +4164,9 @@ func TestUIBannerActionLabelsExposeCancelAndRetryForLifecycleOpen(t *testing.T)
func TestCompactPathDirectorySummaryCollapsesLongPaths(t *testing.T) { func TestCompactPathDirectorySummaryCollapsesLongPaths(t *testing.T) {
t.Parallel() t.Parallel()
got := compactPathDirectorySummary("/home/julian/vaults/family/main.kdbx") got := compactPathDirectorySummary("/home/julian/vaults/bellagio/main.kdbx")
if got != "home/.../family" { if got != "home/.../bellagio" {
t.Fatalf("compactPathDirectorySummary() = %q, want %q", got, "home/.../family") t.Fatalf("compactPathDirectorySummary() = %q, want %q", got, "home/.../bellagio")
} }
short := compactPathDirectorySummary("/tmp/main.kdbx") short := compactPathDirectorySummary("/tmp/main.kdbx")
@@ -4772,7 +4772,7 @@ func TestUIRecentRemoteConnectionsPersistVaultBindingMetadata(t *testing.T) {
first.recentRemotesPath = configPath first.recentRemotesPath = configPath
first.recentRemotes = nil first.recentRemotes = nil
first.currentPath = []string{"Root", "Internet"} first.currentPath = []string{"Root", "Internet"}
first.vaultPath.SetText("/vaults/family.kdbx") first.vaultPath.SetText("/vaults/bellagio.kdbx")
first.selectedVaultRemoteProfileID = "remote-profile-1" first.selectedVaultRemoteProfileID = "remote-profile-1"
first.selectedVaultRemoteCredentialEntryID = "remote-creds-1" first.selectedVaultRemoteCredentialEntryID = "remote-creds-1"
first.selectedVaultRemoteSyncMode = appstate.SyncModeAutomaticOnOpenSave first.selectedVaultRemoteSyncMode = appstate.SyncModeAutomaticOnOpenSave
@@ -4787,8 +4787,8 @@ func TestUIRecentRemoteConnectionsPersistVaultBindingMetadata(t *testing.T) {
t.Fatalf("len(recentRemotes) = %d, want 1", got) t.Fatalf("len(recentRemotes) = %d, want 1", got)
} }
record := second.recentRemotes[0] record := second.recentRemotes[0]
if record.LocalVaultPath != "/vaults/family.kdbx" { if record.LocalVaultPath != "/vaults/bellagio.kdbx" {
t.Fatalf("recentRemotes[0].LocalVaultPath = %q, want /vaults/family.kdbx", record.LocalVaultPath) t.Fatalf("recentRemotes[0].LocalVaultPath = %q, want /vaults/bellagio.kdbx", record.LocalVaultPath)
} }
if record.RemoteProfileID != "remote-profile-1" { if record.RemoteProfileID != "remote-profile-1" {
t.Fatalf("recentRemotes[0].RemoteProfileID = %q, want remote-profile-1", record.RemoteProfileID) t.Fatalf("recentRemotes[0].RemoteProfileID = %q, want remote-profile-1", record.RemoteProfileID)
@@ -4877,14 +4877,14 @@ func TestUIApplyRecentRemoteRecordRestoresVaultBindingSelection(t *testing.T) {
u.applyRecentRemoteRecord(recentRemoteRecord{ u.applyRecentRemoteRecord(recentRemoteRecord{
BaseURL: "https://dav.example.com", BaseURL: "https://dav.example.com",
Path: "vaults/home.kdbx", Path: "vaults/home.kdbx",
LocalVaultPath: "/vaults/family.kdbx", LocalVaultPath: "/vaults/bellagio.kdbx",
RemoteProfileID: "remote-profile-1", RemoteProfileID: "remote-profile-1",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: string(appstate.SyncModeAutomaticOnOpenSave), SyncMode: string(appstate.SyncModeAutomaticOnOpenSave),
}) })
if got := u.vaultPath.Text(); got != "/vaults/family.kdbx" { if got := u.vaultPath.Text(); got != "/vaults/bellagio.kdbx" {
t.Fatalf("vaultPath = %q, want /vaults/family.kdbx", got) t.Fatalf("vaultPath = %q, want /vaults/bellagio.kdbx", got)
} }
if got := u.selectedVaultRemoteProfileID; got != "remote-profile-1" { if got := u.selectedVaultRemoteProfileID; got != "remote-profile-1" {
t.Fatalf("selectedVaultRemoteProfileID = %q, want remote-profile-1", got) t.Fatalf("selectedVaultRemoteProfileID = %q, want remote-profile-1", got)
@@ -5429,8 +5429,8 @@ func TestRestoreStartupLifecycleTargetUsesLocalCacheFromRecentRemote(t *testing.
u.recentVaultUsedAt["/tmp/older.kdbx"] = time.Date(2026, time.April, 5, 1, 2, 3, 0, time.UTC) u.recentVaultUsedAt["/tmp/older.kdbx"] = time.Date(2026, time.April, 5, 1, 2, 3, 0, time.UTC)
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: "/tmp/family-cache.kdbx", LocalVaultPath: "/tmp/bellagio-cache.kdbx",
UsedAt: time.Date(2026, time.April, 5, 2, 2, 3, 0, time.UTC).Format(time.RFC3339Nano), UsedAt: time.Date(2026, time.April, 5, 2, 2, 3, 0, time.UTC).Format(time.RFC3339Nano),
}} }}
@@ -5439,8 +5439,8 @@ func TestRestoreStartupLifecycleTargetUsesLocalCacheFromRecentRemote(t *testing.
if got := u.lifecycleMode; got != "local" { if got := u.lifecycleMode; got != "local" {
t.Fatalf("lifecycleMode after restore = %q, want local", got) t.Fatalf("lifecycleMode after restore = %q, want local", got)
} }
if got := u.vaultPath.Text(); got != "/tmp/family-cache.kdbx" { if got := u.vaultPath.Text(); got != "/tmp/bellagio-cache.kdbx" {
t.Fatalf("vaultPath after restore = %q, want /tmp/family-cache.kdbx", got) t.Fatalf("vaultPath after restore = %q, want /tmp/bellagio-cache.kdbx", got)
} }
} }
@@ -5532,18 +5532,18 @@ func TestUIAvailableRemoteProfilesUsesVaultProfiles(t *testing.T) {
u := newUIWithModel("desktop", vault.Model{ u := newUIWithModel("desktop", vault.Model{
RemoteProfiles: []vault.RemoteProfile{ RemoteProfiles: []vault.RemoteProfile{
{ {
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}, },
{ {
ID: "archive-webdav", ID: "archive-webdav",
Name: "Archive Vault", Name: "Archive Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/archive.kdbx", Path: "files/bellagio/archive.kdbx",
}, },
}, },
}) })
@@ -5552,7 +5552,7 @@ func TestUIAvailableRemoteProfilesUsesVaultProfiles(t *testing.T) {
if len(got) != 2 { if len(got) != 2 {
t.Fatalf("len(availableRemoteProfiles()) = %d, want 2", len(got)) t.Fatalf("len(availableRemoteProfiles()) = %d, want 2", len(got))
} }
if got[0].ID != "archive-webdav" || got[1].ID != "family-webdav" { if got[0].ID != "archive-webdav" || got[1].ID != "bellagio-webdav" {
t.Fatalf("availableRemoteProfiles() = %#v, want profiles sorted by name/id", got) t.Fatalf("availableRemoteProfiles() = %#v, want profiles sorted by name/id", got)
} }
} }
@@ -5590,23 +5590,23 @@ func TestUISelectVaultRemoteProfileUpdatesSelectionAndTargetFields(t *testing.T)
u := newUIWithModel("desktop", vault.Model{ u := newUIWithModel("desktop", vault.Model{
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
u.selectVaultRemoteProfile("family-webdav") u.selectVaultRemoteProfile("bellagio-webdav")
if got := u.selectedVaultRemoteProfileID; got != "family-webdav" { if got := u.selectedVaultRemoteProfileID; got != "bellagio-webdav" {
t.Fatalf("selectedVaultRemoteProfileID = %q, want family-webdav", got) t.Fatalf("selectedVaultRemoteProfileID = %q, want bellagio-webdav", got)
} }
if got := u.remoteBaseURL.Text(); got != "https://dav.example.invalid/remote.php/dav" { if got := u.remoteBaseURL.Text(); got != "https://dav.example.invalid/remote.php/dav" {
t.Fatalf("remoteBaseURL = %q, want resolved profile base URL", got) t.Fatalf("remoteBaseURL = %q, want resolved profile base URL", got)
} }
if got := u.remotePath.Text(); got != "files/family/keepass.kdbx" { if got := u.remotePath.Text(); got != "files/bellagio/keepass.kdbx" {
t.Fatalf("remotePath = %q, want resolved profile path", got) t.Fatalf("remotePath = %q, want resolved profile path", got)
} }
} }
@@ -5660,11 +5660,11 @@ func TestUIShouldHideSavedRemoteBindingSelectorsForSingleChoice(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
@@ -5684,11 +5684,11 @@ func TestUISavedRemoteBindingSummaryUsesImplicitSingleChoice(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
@@ -5696,8 +5696,8 @@ func TestUISavedRemoteBindingSummaryUsesImplicitSingleChoice(t *testing.T) {
if !ok { if !ok {
t.Fatal("savedRemoteBindingSummary() ok = false, want true") t.Fatal("savedRemoteBindingSummary() ok = false, want true")
} }
if profileLabel != "Family Vault" { if profileLabel != "Bellagio Vault" {
t.Fatalf("profileLabel = %q, want Family Vault", profileLabel) t.Fatalf("profileLabel = %q, want Bellagio Vault", profileLabel)
} }
if credentialLabel != "Bellagio WebDAV Sign-In · linuscaldwell" { if credentialLabel != "Bellagio WebDAV Sign-In · linuscaldwell" {
t.Fatalf("credentialLabel = %q, want Bellagio WebDAV Sign-In · linuscaldwell", credentialLabel) t.Fatalf("credentialLabel = %q, want Bellagio WebDAV Sign-In · linuscaldwell", credentialLabel)
@@ -5718,11 +5718,11 @@ func TestUISavedRemoteBindingSummaryMentionsAutomaticSyncMode(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
u.selectedVaultRemoteSyncMode = appstate.SyncModeAutomaticOnOpenSave u.selectedVaultRemoteSyncMode = appstate.SyncModeAutomaticOnOpenSave
@@ -5747,11 +5747,11 @@ func TestUISavedRemoteBindingHeadingUsesSyncLanguageForSingleChoice(t *testing.T
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
@@ -5771,11 +5771,11 @@ func TestUIOpenSelectedVaultRemoteButtonLabelUsesSyncLanguageForSingleChoice(t *
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
@@ -5814,11 +5814,11 @@ func TestUIShouldShowDirectRemoteSyncShortcutForSavedBinding(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
u.state.Section = appstate.SectionEntries u.state.Section = appstate.SectionEntries
@@ -5844,11 +5844,11 @@ func TestUIRemoteSyncShortcutsHaveParityAcrossModes(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
u.state.Section = appstate.SectionEntries u.state.Section = appstate.SectionEntries
@@ -5964,11 +5964,11 @@ func TestUIShouldHideRemoteSyncSetupShortcutWhenSavedBindingExists(t *testing.T)
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
u.state.Section = appstate.SectionEntries u.state.Section = appstate.SectionEntries
@@ -5992,7 +5992,7 @@ func TestUILifecycleRemoteSyncActionLabelUsesSetupLanguageWithoutSavedBinding(t
t.Parallel() t.Parallel()
u := newUIWithSession("desktop", &session.Manager{}) u := newUIWithSession("desktop", &session.Manager{})
u.vaultPath.SetText("/vaults/family.kdbx") u.vaultPath.SetText("/vaults/bellagio.kdbx")
if !u.shouldShowLifecycleRemoteSyncAction() { if !u.shouldShowLifecycleRemoteSyncAction() {
t.Fatal("shouldShowLifecycleRemoteSyncAction() = false, want true with a selected vault") t.Fatal("shouldShowLifecycleRemoteSyncAction() = false, want true with a selected vault")
@@ -6012,12 +6012,12 @@ func TestUILifecycleRemoteSyncActionLabelUsesSettingsLanguageWithSavedBinding(t
RecentRemotesPath: filepath.Join(dir, "recent-remotes.json"), RecentRemotesPath: filepath.Join(dir, "recent-remotes.json"),
UIPreferencesPath: filepath.Join(dir, "ui-prefs.json"), UIPreferencesPath: filepath.Join(dir, "ui-prefs.json"),
}) })
u.vaultPath.SetText("/vaults/family.kdbx") u.vaultPath.SetText("/vaults/bellagio.kdbx")
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: "/vaults/family.kdbx", LocalVaultPath: "/vaults/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: string(appstate.SyncModeManual), SyncMode: string(appstate.SyncModeManual),
}} }}
@@ -6038,11 +6038,11 @@ func TestUIShouldShowRemoteSyncSettingsShortcutForSavedBinding(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
u.state.Section = appstate.SectionEntries u.state.Section = appstate.SectionEntries
@@ -6073,11 +6073,11 @@ func TestUIShouldShowRemoveRemoteSyncShortcutForSavedBinding(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
u.state.Section = appstate.SectionEntries u.state.Section = appstate.SectionEntries
@@ -6109,14 +6109,14 @@ func TestUIOpenRemoteSyncSetupDialogPrefillsCurrentVaultSetupFlow(t *testing.T)
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
u.vaultPath.SetText("/vaults/family.kdbx") u.vaultPath.SetText("/vaults/bellagio.kdbx")
u.openRemoteSyncSetupDialog() u.openRemoteSyncSetupDialog()
@@ -6132,13 +6132,13 @@ func TestUIOpenRemoteSyncSetupDialogPrefillsCurrentVaultSetupFlow(t *testing.T)
if got := u.syncDirection; got != syncDirectionPush { if got := u.syncDirection; got != syncDirectionPush {
t.Fatalf("syncDirection = %q, want push", got) t.Fatalf("syncDirection = %q, want push", got)
} }
if got := u.syncLocalPath.Text(); got != "/vaults/family.kdbx" { if got := u.syncLocalPath.Text(); got != "/vaults/bellagio.kdbx" {
t.Fatalf("syncLocalPath = %q, want current vault path", got) t.Fatalf("syncLocalPath = %q, want current vault path", got)
} }
if got := u.syncRemoteBaseURL.Text(); got != "https://dav.example.invalid/remote.php/dav" { if got := u.syncRemoteBaseURL.Text(); got != "https://dav.example.invalid/remote.php/dav" {
t.Fatalf("syncRemoteBaseURL = %q, want saved remote base URL", got) t.Fatalf("syncRemoteBaseURL = %q, want saved remote base URL", got)
} }
if got := u.syncRemotePath.Text(); got != "files/family/keepass.kdbx" { if got := u.syncRemotePath.Text(); got != "files/bellagio/keepass.kdbx" {
t.Fatalf("syncRemotePath = %q, want saved remote path", got) t.Fatalf("syncRemotePath = %q, want saved remote path", got)
} }
if got := u.syncRemoteUsername.Text(); got != "linuscaldwell" { if got := u.syncRemoteUsername.Text(); got != "linuscaldwell" {
@@ -6153,7 +6153,7 @@ func TestUILifecycleRemoteSyncActionOpensSetupAfterVaultOpen(t *testing.T) {
t.Parallel() t.Parallel()
key := vault.MasterKey{Password: "correct horse battery staple"} key := vault.MasterKey{Password: "correct horse battery staple"}
path := filepath.Join(t.TempDir(), "family.kdbx") path := filepath.Join(t.TempDir(), "bellagio.kdbx")
writeKDBXMainTestFile(t, path, vault.Model{ writeKDBXMainTestFile(t, path, vault.Model{
Entries: []vault.Entry{{ Entries: []vault.Entry{{
ID: "vault-console", ID: "vault-console",
@@ -6186,7 +6186,7 @@ func TestUILifecycleRemoteSyncActionOpensSettingsAfterVaultOpen(t *testing.T) {
t.Parallel() t.Parallel()
key := vault.MasterKey{Password: "correct horse battery staple"} key := vault.MasterKey{Password: "correct horse battery staple"}
path := filepath.Join(t.TempDir(), "family.kdbx") path := filepath.Join(t.TempDir(), "bellagio.kdbx")
writeKDBXMainTestFile(t, path, vault.Model{ writeKDBXMainTestFile(t, path, vault.Model{
Entries: []vault.Entry{ Entries: []vault.Entry{
{ {
@@ -6207,11 +6207,11 @@ func TestUILifecycleRemoteSyncActionOpensSettingsAfterVaultOpen(t *testing.T) {
}, },
}, },
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}, key) }, key)
@@ -6226,9 +6226,9 @@ func TestUILifecycleRemoteSyncActionOpensSettingsAfterVaultOpen(t *testing.T) {
u.vaultPath.SetText(path) u.vaultPath.SetText(path)
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: path, LocalVaultPath: path,
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: string(appstate.SyncModeManual), SyncMode: string(appstate.SyncModeManual),
}} }}
@@ -6257,7 +6257,7 @@ func TestUISelectedLocalVaultRemoteSyncSummaryMentionsSetup(t *testing.T) {
UIPreferencesPath: filepath.Join(dir, "ui-prefs.json"), UIPreferencesPath: filepath.Join(dir, "ui-prefs.json"),
}) })
if got := u.selectedLocalVaultRemoteSyncSummary("/vaults/family.kdbx"); got != "Open this vault to set up a WebDAV sync target for it." { if got := u.selectedLocalVaultRemoteSyncSummary("/vaults/bellagio.kdbx"); got != "Open this vault to set up a WebDAV sync target for it." {
t.Fatalf("selectedLocalVaultRemoteSyncSummary() = %q, want setup guidance", got) t.Fatalf("selectedLocalVaultRemoteSyncSummary() = %q, want setup guidance", got)
} }
} }
@@ -6274,14 +6274,14 @@ func TestUISelectedLocalVaultRemoteSyncSummaryMentionsAutomaticSync(t *testing.T
}) })
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: "/vaults/family.kdbx", LocalVaultPath: "/vaults/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: string(appstate.SyncModeAutomaticOnOpenSave), SyncMode: string(appstate.SyncModeAutomaticOnOpenSave),
}} }}
if got := u.selectedLocalVaultRemoteSyncSummary("/vaults/family.kdbx"); got != "Saved remote sync target: keepass.kdbx · dav.example.invalid · Syncs automatically on open and save." { if got := u.selectedLocalVaultRemoteSyncSummary("/vaults/bellagio.kdbx"); got != "Saved remote sync target: keepass.kdbx · dav.example.invalid · Syncs automatically on open and save." {
t.Fatalf("selectedLocalVaultRemoteSyncSummary() = %q, want automatic sync guidance", got) t.Fatalf("selectedLocalVaultRemoteSyncSummary() = %q, want automatic sync guidance", got)
} }
} }
@@ -6298,14 +6298,14 @@ func TestUISelectedLocalVaultRemoteSyncSummaryMentionsManualSync(t *testing.T) {
}) })
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: "/vaults/family.kdbx", LocalVaultPath: "/vaults/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: string(appstate.SyncModeManual), SyncMode: string(appstate.SyncModeManual),
}} }}
if got := u.selectedLocalVaultRemoteSyncSummary("/vaults/family.kdbx"); got != "Saved remote sync target: keepass.kdbx · dav.example.invalid · Sync manually when you choose Use Remote Sync." { if got := u.selectedLocalVaultRemoteSyncSummary("/vaults/bellagio.kdbx"); got != "Saved remote sync target: keepass.kdbx · dav.example.invalid · Sync manually when you choose Use Remote Sync." {
t.Fatalf("selectedLocalVaultRemoteSyncSummary() = %q, want manual sync guidance", got) t.Fatalf("selectedLocalVaultRemoteSyncSummary() = %q, want manual sync guidance", got)
} }
} }
@@ -6352,20 +6352,20 @@ func TestUISyncDialogUsesRemoteSettingsCopyForExistingBinding(t *testing.T) {
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}) })
u.state.Section = appstate.SectionEntries u.state.Section = appstate.SectionEntries
u.vaultPath.SetText("/vaults/family.kdbx") u.vaultPath.SetText("/vaults/bellagio.kdbx")
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: "/vaults/family.kdbx", LocalVaultPath: "/vaults/bellagio.kdbx",
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: string(appstate.SyncModeManual), SyncMode: string(appstate.SyncModeManual),
}} }}
@@ -6584,11 +6584,11 @@ func TestUIRemoveSelectedRemoteBindingActionClearsVaultBindingAndRecentRefs(t *t
Path: []string{"Crew", "Internet"}, Path: []string{"Crew", "Internet"},
}}, }},
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}, key) }, key)
@@ -6603,9 +6603,9 @@ func TestUIRemoveSelectedRemoteBindingActionClearsVaultBindingAndRecentRefs(t *t
u.vaultPath.SetText(currentPath) u.vaultPath.SetText(currentPath)
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: currentPath, LocalVaultPath: currentPath,
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
SyncMode: string(appstate.SyncModeAutomaticOnOpenSave), SyncMode: string(appstate.SyncModeAutomaticOnOpenSave),
}} }}
@@ -6664,9 +6664,9 @@ func TestUISaveCurrentRemoteBindingActionPersistsBindingIntoVault(t *testing.T)
u := newUIWithModel("desktop", vault.Model{}) u := newUIWithModel("desktop", vault.Model{})
u.currentPath = []string{"Crew", "Internet"} u.currentPath = []string{"Crew", "Internet"}
u.vaultPath.SetText("/tmp/family.kdbx") u.vaultPath.SetText("/tmp/bellagio.kdbx")
u.remoteBaseURL.SetText("https://dav.example.invalid/remote.php/dav") u.remoteBaseURL.SetText("https://dav.example.invalid/remote.php/dav")
u.remotePath.SetText("files/family/keepass.kdbx") u.remotePath.SetText("files/bellagio/keepass.kdbx")
u.remoteUsername.SetText("linuscaldwell") u.remoteUsername.SetText("linuscaldwell")
u.remotePassword.SetText("bellagio-pass-1") u.remotePassword.SetText("bellagio-pass-1")
@@ -6735,18 +6735,18 @@ func TestUIAdvancedSyncMatchingRemoteCredentialEntriesUsesBaseURL(t *testing.T)
func TestUIAdvancedSyncMatchingRemoteCredentialEntriesUsesSavedBindingForCurrentVault(t *testing.T) { func TestUIAdvancedSyncMatchingRemoteCredentialEntriesUsesSavedBindingForCurrentVault(t *testing.T) {
t.Parallel() t.Parallel()
localVaultPath := filepath.Join(t.TempDir(), "family.kdbx") localVaultPath := filepath.Join(t.TempDir(), "bellagio.kdbx")
u := newUIWithState("desktop", &uiSession{model: vault.Model{ u := newUIWithState("desktop", &uiSession{model: vault.Model{
Entries: []vault.Entry{ Entries: []vault.Entry{
{ID: "remote-creds-1", Title: "Bellagio WebDAV Sign-In", Username: "linuscaldwell", Path: []string{"Crew", "Internet"}}, {ID: "remote-creds-1", Title: "Bellagio WebDAV Sign-In", Username: "linuscaldwell", Path: []string{"Crew", "Internet"}},
{ID: "entry-2", Title: "Vault Console", Username: "dannyocean", URL: "https://vault.crew.example.invalid", Path: []string{"Crew", "Internet"}}, {ID: "entry-2", Title: "Vault Console", Username: "dannyocean", URL: "https://vault.crew.example.invalid", Path: []string{"Crew", "Internet"}},
}, },
RemoteProfiles: []vault.RemoteProfile{{ RemoteProfiles: []vault.RemoteProfile{{
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: vault.RemoteBackendWebDAV, Backend: vault.RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}}, }},
}}, statePaths{ }}, statePaths{
DefaultSaveAsPath: filepath.Join(t.TempDir(), "default.kdbx"), DefaultSaveAsPath: filepath.Join(t.TempDir(), "default.kdbx"),
@@ -6757,12 +6757,12 @@ func TestUIAdvancedSyncMatchingRemoteCredentialEntriesUsesSavedBindingForCurrent
u.vaultPath.SetText(localVaultPath) u.vaultPath.SetText(localVaultPath)
u.syncSourceMode = syncSourceRemote u.syncSourceMode = syncSourceRemote
u.syncRemoteBaseURL.SetText("https://dav.example.invalid/remote.php/dav") u.syncRemoteBaseURL.SetText("https://dav.example.invalid/remote.php/dav")
u.syncRemotePath.SetText("files/family/keepass.kdbx") u.syncRemotePath.SetText("files/bellagio/keepass.kdbx")
u.recentRemotes = []recentRemoteRecord{{ u.recentRemotes = []recentRemoteRecord{{
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
LocalVaultPath: localVaultPath, LocalVaultPath: localVaultPath,
RemoteProfileID: "family-webdav", RemoteProfileID: "bellagio-webdav",
CredentialEntryID: "remote-creds-1", CredentialEntryID: "remote-creds-1",
}} }}
@@ -6804,9 +6804,9 @@ func TestUISaveCurrentRemoteBindingActionRequiresCompleteRemoteSignIn(t *testing
t.Parallel() t.Parallel()
u := newUIWithModel("desktop", vault.Model{}) u := newUIWithModel("desktop", vault.Model{})
u.vaultPath.SetText("/tmp/family.kdbx") u.vaultPath.SetText("/tmp/bellagio.kdbx")
u.remoteBaseURL.SetText("https://dav.example.invalid/remote.php/dav") u.remoteBaseURL.SetText("https://dav.example.invalid/remote.php/dav")
u.remotePath.SetText("files/family/keepass.kdbx") u.remotePath.SetText("files/bellagio/keepass.kdbx")
if err := u.saveCurrentRemoteBindingAction(); err == nil { if err := u.saveCurrentRemoteBindingAction(); err == nil {
t.Fatal("saveCurrentRemoteBindingAction() error = nil, want validation error") t.Fatal("saveCurrentRemoteBindingAction() error = nil, want validation error")
@@ -6982,9 +6982,9 @@ func TestFriendlyRecentRemoteLabelUsesVaultNameBeforeHost(t *testing.T) {
got := friendlyRecentRemoteLabel(recentRemoteRecord{ got := friendlyRecentRemoteLabel(recentRemoteRecord{
BaseURL: "https://dav.example.com/remote.php/webdav/", BaseURL: "https://dav.example.com/remote.php/webdav/",
Path: "vaults/family/home.kdbx", Path: "vaults/bellagio/mint.kdbx",
}) })
want := "home.kdbx · dav.example.com" want := "mint.kdbx · dav.example.com"
if got != want { if got != want {
t.Fatalf("friendlyRecentRemoteLabel() = %q, want %q", got, want) t.Fatalf("friendlyRecentRemoteLabel() = %q, want %q", got, want)
} }
+7 -7
View File
@@ -244,11 +244,11 @@ func TestSaveKDBXRoundTripsRemoteProfiles(t *testing.T) {
model := Model{ model := Model{
RemoteProfiles: []RemoteProfile{ RemoteProfiles: []RemoteProfile{
{ {
ID: "family-webdav", ID: "bellagio-webdav",
Name: "Family Vault", Name: "Bellagio Vault",
Backend: RemoteBackendWebDAV, Backend: RemoteBackendWebDAV,
BaseURL: "https://dav.example.invalid/remote.php/dav", BaseURL: "https://dav.example.invalid/remote.php/dav",
Path: "files/family/keepass.kdbx", Path: "files/bellagio/keepass.kdbx",
}, },
}, },
} }
@@ -268,8 +268,8 @@ func TestSaveKDBXRoundTripsRemoteProfiles(t *testing.T) {
} }
got := loaded.RemoteProfiles[0] got := loaded.RemoteProfiles[0]
if got.ID != "family-webdav" || got.Name != "Family Vault" { if got.ID != "bellagio-webdav" || got.Name != "Bellagio Vault" {
t.Fatalf("loaded remote profile = %#v, want family-webdav Family Vault", got) t.Fatalf("loaded remote profile = %#v, want bellagio-webdav Bellagio Vault", got)
} }
if got.Backend != RemoteBackendWebDAV { if got.Backend != RemoteBackendWebDAV {
t.Fatalf("remote backend = %q, want %q", got.Backend, RemoteBackendWebDAV) t.Fatalf("remote backend = %q, want %q", got.Backend, RemoteBackendWebDAV)
@@ -277,8 +277,8 @@ func TestSaveKDBXRoundTripsRemoteProfiles(t *testing.T) {
if got.BaseURL != "https://dav.example.invalid/remote.php/dav" { if got.BaseURL != "https://dav.example.invalid/remote.php/dav" {
t.Fatalf("remote base URL = %q, want remote.php/dav URL", got.BaseURL) t.Fatalf("remote base URL = %q, want remote.php/dav URL", got.BaseURL)
} }
if got.Path != "files/family/keepass.kdbx" { if got.Path != "files/bellagio/keepass.kdbx" {
t.Fatalf("remote path = %q, want files/family/keepass.kdbx", got.Path) t.Fatalf("remote path = %q, want files/bellagio/keepass.kdbx", got.Path)
} }
} }