Skip to content

Commit

Permalink
fix getRecoveryKey test
Browse files Browse the repository at this point in the history
  • Loading branch information
weswhet committed Jan 31, 2025
1 parent 4547678 commit e4531ab
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/checkin/escrow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ func (m *MockPref) Delete(key string) error {
return nil
}

func (m *MockPref) GetDate(key string) (time.Time, error) {
return time.Now(), nil
}

func (m *MockPref) SetDate(key string, value time.Time) error {
return nil
}

func TestGetCommand(t *testing.T) {
p := &MockPref{}

Expand Down Expand Up @@ -272,6 +280,7 @@ func TestGetRecoveryKey(t *testing.T) {
}

key := keyPlist{RecoveryKey: "test_recovery_key"}
p := &MockPref{}

tmpFile, err := os.CreateTemp(os.TempDir(), "crypt-testing-")
assert.NoError(t, err)
Expand All @@ -283,7 +292,7 @@ func TestGetRecoveryKey(t *testing.T) {
err = os.WriteFile(tmpFile.Name(), plistBytes, 0644)
assert.NoError(t, err)

out, err := getRecoveryKey(tmpFile.Name())
out, err := getRecoveryKey(tmpFile.Name(), p)
if err != nil {
t.Fatalf("getRecoveryKey failed with error: %v", err)
}
Expand Down

0 comments on commit e4531ab

Please sign in to comment.