mirror of
https://github.com/rclone/rclone.git
synced 2026-01-06 18:43:50 +00:00
config: add config/setpath for setting config path via rc/librclone
This commit is contained in:
@@ -153,3 +153,21 @@ func TestRcProviders(t *testing.T) {
|
||||
}
|
||||
assert.True(t, foundLocal, "didn't find local provider")
|
||||
}
|
||||
|
||||
func TestRcSetPath(t *testing.T) {
|
||||
oldPath := config.GetConfigPath()
|
||||
newPath := oldPath + ".newPath"
|
||||
call := rc.Calls.Get("config/setpath")
|
||||
assert.NotNil(t, call)
|
||||
in := rc.Params{
|
||||
"path": newPath,
|
||||
}
|
||||
_, err := call.Fn(context.Background(), in)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, newPath, config.GetConfigPath())
|
||||
|
||||
in["path"] = oldPath
|
||||
_, err = call.Fn(context.Background(), in)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, oldPath, config.GetConfigPath())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user