MCPcopy
hub / github.com/rclone/rclone / TestConfigLoadEncryptedWithInvalidPassCommand

Function TestConfigLoadEncryptedWithInvalidPassCommand

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

Source from the content-addressed store, hash-verified

71}
72
73func TestConfigLoadEncryptedWithInvalidPassCommand(t *testing.T) {
74 ctx := context.Background()
75 ci := fs.GetConfig(ctx)
76 oldConfigPath := config.GetConfigPath()
77 oldConfig := *ci
78 assert.NoError(t, config.SetConfigPath("./testdata/encrypted.conf"))
79 // using ci.PasswordCommand, incorrect password
80 ci.PasswordCommand = fs.SpaceSepList{"echo", "asdf-blurfl"}
81 defer func() {
82 assert.NoError(t, config.SetConfigPath(oldConfigPath))
83 config.ClearConfigPassword()
84 *ci = oldConfig
85 ci.PasswordCommand = nil
86 }()
87
88 config.ClearConfigPassword()
89
90 err := config.Data().Load()
91 require.Error(t, err)
92 assert.Contains(t, err.Error(), "using --password-command derived password")
93}
94
95func TestConfigLoadEncryptedFailures(t *testing.T) {
96 var err error

Callers

nothing calls this directly

Calls 8

GetConfigFunction · 0.92
GetConfigPathFunction · 0.92
SetConfigPathFunction · 0.92
ClearConfigPasswordFunction · 0.92
DataFunction · 0.92
ContainsMethod · 0.80
LoadMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…