MCPcopy
hub / github.com/rclone/rclone / TestConfigLoadEncryptedFailures

Function TestConfigLoadEncryptedFailures

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

Source from the content-addressed store, hash-verified

93}
94
95func TestConfigLoadEncryptedFailures(t *testing.T) {
96 var err error
97
98 // This file should be too short to be decoded.
99 oldConfigPath := config.GetConfigPath()
100 assert.NoError(t, config.SetConfigPath("./testdata/enc-short.conf"))
101 defer func() { assert.NoError(t, config.SetConfigPath(oldConfigPath)) }()
102 err = config.Data().Load()
103 require.Error(t, err)
104
105 // This file contains invalid base64 characters.
106 assert.NoError(t, config.SetConfigPath("./testdata/enc-invalid.conf"))
107 err = config.Data().Load()
108 require.Error(t, err)
109
110 // This file contains invalid base64 characters.
111 assert.NoError(t, config.SetConfigPath("./testdata/enc-too-new.conf"))
112 err = config.Data().Load()
113 require.Error(t, err)
114
115 // This file does not exist.
116 assert.NoError(t, config.SetConfigPath("./testdata/filenotfound.conf"))
117 err = config.Data().Load()
118 assert.Equal(t, config.ErrorConfigFileNotFound, err)
119}
120
121func TestGetPasswordCommand(t *testing.T) {
122 ctx, ci := fs.AddConfig(context.Background())

Callers

nothing calls this directly

Calls 6

GetConfigPathFunction · 0.92
SetConfigPathFunction · 0.92
DataFunction · 0.92
LoadMethod · 0.65
ErrorMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…