mirror of
https://github.com/rclone/rclone.git
synced 2024-11-26 18:34:41 +01:00
23a0d4a1e6
Fixes #5222
30 lines
799 B
Go
30 lines
799 B
Go
// These are in an external package because we need to import configfile
|
|
|
|
package config_test
|
|
|
|
import (
|
|
"context"
|
|
"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.LoadConfig(context.Background())
|
|
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)
|
|
}
|