mirror of
https://github.com/rclone/rclone.git
synced 2025-04-19 18:31:10 +08:00
rc: listremotes should send an empty array
This commit is contained in:
parent
894ef3b375
commit
86edbed328
@ -75,6 +75,9 @@ See the [listremotes](/commands/rclone_listremotes/) command for more informatio
|
||||
// including any defined by environment variables.
|
||||
func rcListRemotes(ctx context.Context, in rc.Params) (out rc.Params, err error) {
|
||||
remoteNames := GetRemoteNames()
|
||||
if remoteNames == nil {
|
||||
remoteNames = []string{}
|
||||
}
|
||||
out = rc.Params{
|
||||
"remotes": remoteNames,
|
||||
}
|
||||
|
@ -138,6 +138,22 @@ func TestRc(t *testing.T) {
|
||||
assert.Nil(t, out)
|
||||
assert.Equal(t, "", config.GetValue(testName, "type"))
|
||||
assert.Equal(t, "", config.GetValue(testName, "test_key"))
|
||||
|
||||
t.Run("ListRemotes empty not nil", func(t *testing.T) {
|
||||
call := rc.Calls.Get("config/listremotes")
|
||||
assert.NotNil(t, call)
|
||||
in := rc.Params{}
|
||||
out, err := call.Fn(context.Background(), in)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, out)
|
||||
|
||||
var remotes []string
|
||||
err = out.GetStruct("remotes", &remotes)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.NotNil(t, remotes)
|
||||
assert.Empty(t, remotes)
|
||||
})
|
||||
}
|
||||
|
||||
func TestRcProviders(t *testing.T) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user