mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 22:22:21 +08:00
f8d56bebaf
Restructuring of config code in v1.55 resulted in config file being loaded early at process startup. If configuration file is encrypted this means user will need to supply the password, even when running commands that does not use config. This also lead to an issue where mount with --deamon failed to decrypt the config file when it had to prompt user for passord. Fixes #5236 Fixes #5228
29 lines
769 B
Go
29 lines
769 B
Go
// These are in an external package because we need to import configfile
|
|
|
|
package config_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/rclone/rclone/fs/config"
|
|
"github.com/rclone/rclone/fs/config/configfile"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestConfigLoad(t *testing.T) {
|
|
oldConfigPath := config.GetConfigPath()
|
|
assert.NoError(t, config.SetConfigPath("./testdata/plain.conf"))
|
|
defer func() {
|
|
assert.NoError(t, config.SetConfigPath(oldConfigPath))
|
|
}()
|
|
config.ClearConfigPassword()
|
|
configfile.Install()
|
|
sections := config.Data().GetSectionList()
|
|
var expect = []string{"RCLONE_ENCRYPT_V0", "nounc", "unc"}
|
|
assert.Equal(t, expect, sections)
|
|
|
|
keys := config.Data().GetKeyList("nounc")
|
|
expect = []string{"type", "nounc"}
|
|
assert.Equal(t, expect, keys)
|
|
}
|