mirror of
https://github.com/rclone/rclone.git
synced 2025-12-11 22:14:05 +01:00
core/command: Allow rc to execute rclone terminal commands.
Allow command parameter to be skipped.
This commit is contained in:
committed by
Nick Craig-Wood
parent
3d5a63607e
commit
5549fd25fc
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user