MCPcopy
hub / github.com/rclone/rclone / TestConfigLoadEncrypted

Function TestConfigLoadEncrypted

fs/config/crypt_test.go:19–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func 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
44func TestConfigLoadEncryptedWithValidPassCommand(t *testing.T) {
45 ctx := context.Background()

Callers

nothing calls this directly

Calls 10

GetConfigPathFunction · 0.92
SetConfigPathFunction · 0.92
ClearConfigPasswordFunction · 0.92
IsEncryptedFunction · 0.92
SetConfigPasswordFunction · 0.92
DataFunction · 0.92
LoadMethod · 0.65
GetSectionListMethod · 0.65
GetKeyListMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…