(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestConfigLoadEncrypted(t *testing.T) { |
| 20 | var err error |
| 21 | oldConfigPath := config.GetConfigPath() |
| 22 | assert.NoError(t, config.SetConfigPath("./testdata/encrypted.conf")) |
| 23 | defer func() { |
| 24 | assert.NoError(t, config.SetConfigPath(oldConfigPath)) |
| 25 | config.ClearConfigPassword() |
| 26 | }() |
| 27 | |
| 28 | // Set correct password |
| 29 | assert.False(t, config.IsEncrypted()) |
| 30 | err = config.SetConfigPassword("asdf") |
| 31 | require.NoError(t, err) |
| 32 | assert.True(t, config.IsEncrypted()) |
| 33 | err = config.Data().Load() |
| 34 | require.NoError(t, err) |
| 35 | sections := config.Data().GetSectionList() |
| 36 | var expect = []string{"nounc", "unc"} |
| 37 | assert.Equal(t, expect, sections) |
| 38 | |
| 39 | keys := config.Data().GetKeyList("nounc") |
| 40 | expect = []string{"type", "nounc"} |
| 41 | assert.Equal(t, expect, keys) |
| 42 | } |
| 43 | |
| 44 | func TestConfigLoadEncryptedWithValidPassCommand(t *testing.T) { |
| 45 | ctx := context.Background() |
nothing calls this directly
no test coverage detected
searching dependent graphs…