From aaafcb35d401c685d5e9bb016ff117036f575ec2 Mon Sep 17 00:00:00 2001 From: "Richard T. Carback III" <rick.carback@gmail.com> Date: Mon, 6 Jun 2022 20:26:25 +0000 Subject: [PATCH] Fix backup tests --- backup/backup.go | 2 +- backup/backup_test.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backup/backup.go b/backup/backup.go index 38ebfe65e..46f5bf730 100644 --- a/backup/backup.go +++ b/backup/backup.go @@ -138,7 +138,7 @@ func InitializeBackup(password string, updateBackupCb UpdateBackupFn, func ResumeBackup(updateBackupCb UpdateBackupFn, container *messenger.Container, e2e E2e, session Session, ud UserDiscovery, kv *versioned.KV, rng *fastRNG.StreamGenerator) (*Backup, error) { - _, _, _, err := loadBackup(store.GetKV()) + _, _, _, err := loadBackup(kv) if err != nil { return nil, err } diff --git a/backup/backup_test.go b/backup/backup_test.go index 5b1f87377..f61dc0a06 100644 --- a/backup/backup_test.go +++ b/backup/backup_test.go @@ -113,7 +113,7 @@ func Test_ResumeBackup(t *testing.T) { } // Get key, salt, and parameters of resumed backup - key2, salt2, _, err := loadBackup(b.store.GetKV()) + key2, salt2, _, err := loadBackup(b.kv) if err != nil { t.Errorf("Failed to load key, salt, and params from resumed "+ "backup: %+v", err) @@ -148,7 +148,9 @@ func Test_ResumeBackup(t *testing.T) { func Test_resumeBackup_NoKeyError(t *testing.T) { expectedErr := "object not found" s := storage.InitTestingSession(t) - _, err := resumeBackup(nil, nil, s, &interfaces.BackupContainer{}, nil) + rngGen := fastRNG.NewStreamGenerator(1000, 10, csprng.NewSystemRNG) + _, err := ResumeBackup(nil, &messenger.Container{}, newMockE2e(t), newMockSession(t), + newMockUserDiscovery(), s.GetKV(), rngGen) if err == nil || !strings.Contains(err.Error(), expectedErr) { t.Errorf("ResumeBackup did not return the expected error when no "+ "password is present.\nexpected: %s\nreceived: %+v", expectedErr, err) -- GitLab