core/command: Allow rc to execute rclone terminal commands.

Allow command parameter to be skipped.
This commit is contained in:
Chaitanya Bankanhal
2020-07-14 23:39:59 +05:30
committed by Nick Craig-Wood
parent 3d5a63607e
commit 5549fd25fc
2 changed files with 134 additions and 0 deletions

View File

@@ -5,6 +5,8 @@ import (
"runtime"
"testing"
"github.com/rclone/rclone/fstest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
@@ -119,3 +121,27 @@ func TestCoreQuit(t *testing.T) {
_, err := call.Fn(context.Background(), in)
require.Error(t, err)
}
// core/command: Runs a raw rclone command
func TestCoreCommand(t *testing.T) {
call := Calls.Get("core/command")
r := fstest.NewRun(t)
defer r.Finalise()
in := Params{
"command": "ls",
"opt": map[string]string{
"max-depth": "1",
},
"arg": []string{
r.FremoteName,
},
}
got, err := call.Fn(context.Background(), in)
require.NoError(t, err)
errorBool, err := got.GetBool("error")
require.NoError(t, err)
require.Equal(t, errorBool, false)
}