mirror of
https://github.com/rclone/rclone.git
synced 2024-11-24 17:34:57 +01:00
ffb2e2a6de
Before this change, rclone ignored the --password-command on the rclone config setting except when decrypting an existing config file. This change allows for offloading the password storage/generation into external hardware key or other protected password storage. Fixes #7859
32 lines
786 B
Go
32 lines
786 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 init() {
|
|
configfile.Install()
|
|
}
|
|
|
|
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()
|
|
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)
|
|
}
|