use getUserConfigDir also in tests

Signed-off-by: Boris Kreitchman <bkreitch@gmail.com>
This commit is contained in:
Boris Kreitchman 2023-11-13 09:38:09 +02:00
Родитель c6ce6dfcae
Коммит 2b97ff222b
1 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -313,8 +313,8 @@ func TestMasterKey_loadIdentities(t *testing.T) {
tmpDir := t.TempDir()
overwriteUserConfigDir(t, tmpDir)
// We need to use os.UserConfigDir and not tmpDir as it may add a suffix
cfgDir, err := os.UserConfigDir()
// We need to use getUserConfigDir and not tmpDir as it may add a suffix
cfgDir, err := getUserConfigDir()
assert.NoError(t, err)
keyPath := filepath.Join(cfgDir, SopsAgeKeyUserConfigPath)
assert.True(t, strings.HasPrefix(keyPath, cfgDir))
@ -341,8 +341,8 @@ func TestMasterKey_loadIdentities(t *testing.T) {
tmpDir := t.TempDir()
overwriteUserConfigDir(t, tmpDir)
// We need to use os.UserConfigDir and not tmpDir as it may add a suffix
cfgDir, err := os.UserConfigDir()
// We need to use getUserConfigDir and not tmpDir as it may add a suffix
cfgDir, err := getUserConfigDir()
assert.NoError(t, err)
keyPath1 := filepath.Join(cfgDir, SopsAgeKeyUserConfigPath)
assert.True(t, strings.HasPrefix(keyPath1, cfgDir))