mirror of
https://github.com/rclone/rclone.git
synced 2025-12-15 15:53:41 +00:00
Compare commits
2 Commits
v1.72-stab
...
test
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be2c44f5af | ||
|
|
1db0f51be4 |
@@ -20,7 +20,7 @@ Unlocks the config file if it is locked.
|
||||
|
||||
Parameters:
|
||||
|
||||
- 'config_password' - password to unlock the config file
|
||||
- 'configPassword' - password to unlock the config file
|
||||
|
||||
A good idea is to disable AskPassword before making this call
|
||||
`,
|
||||
@@ -30,9 +30,13 @@ A good idea is to disable AskPassword before making this call
|
||||
// Unlock the config file
|
||||
// A good idea is to disable AskPassword before making this call
|
||||
func rcConfigPassword(ctx context.Context, in rc.Params) (out rc.Params, err error) {
|
||||
configPass, err := in.GetString("config_password")
|
||||
configPass, err := in.GetString("configPassword")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
var err2 error
|
||||
configPass, err2 = in.GetString("config_password") // backwards compat
|
||||
if err2 != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if SetConfigPassword(configPass) != nil {
|
||||
return nil, errors.New("failed to set config password")
|
||||
|
||||
@@ -215,13 +215,26 @@ func TestRcPaths(t *testing.T) {
|
||||
func TestRcConfigUnlock(t *testing.T) {
|
||||
call := rc.Calls.Get("config/unlock")
|
||||
assert.NotNil(t, call)
|
||||
|
||||
in := rc.Params{
|
||||
"config_password": "test",
|
||||
"configPassword": "test",
|
||||
}
|
||||
out, err := call.Fn(context.Background(), in)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.Nil(t, err)
|
||||
assert.Nil(t, out)
|
||||
|
||||
in = rc.Params{
|
||||
"config_password": "test",
|
||||
}
|
||||
out, err = call.Fn(context.Background(), in)
|
||||
require.NoError(t, err)
|
||||
assert.Nil(t, out)
|
||||
|
||||
in = rc.Params{
|
||||
"bad_config_password": "test",
|
||||
}
|
||||
out, err = call.Fn(context.Background(), in)
|
||||
require.Error(t, err)
|
||||
assert.ErrorContains(t, err, `Didn't find key "configPassword" in input`)
|
||||
assert.Nil(t, out)
|
||||
}
|
||||
|
||||
@@ -425,8 +425,8 @@ Results:
|
||||
|
||||
- executeId - string id of rclone executing (change after restart)
|
||||
- jobids - array of integer job ids (starting at 1 on each restart)
|
||||
- running_ids - array of integer job ids that are running
|
||||
- finished_ids - array of integer job ids that are finished
|
||||
- runningIds - array of integer job ids that are running
|
||||
- finishedIds - array of integer job ids that are finished
|
||||
`,
|
||||
})
|
||||
}
|
||||
@@ -436,8 +436,8 @@ func rcJobList(ctx context.Context, in rc.Params) (out rc.Params, err error) {
|
||||
out = make(rc.Params)
|
||||
out["jobids"] = running.IDs()
|
||||
runningIDs, finishedIDs := running.Stats()
|
||||
out["running_ids"] = runningIDs
|
||||
out["finished_ids"] = finishedIDs
|
||||
out["runningIds"] = runningIDs
|
||||
out["finishedIds"] = finishedIDs
|
||||
out["executeId"] = executeID
|
||||
return out, nil
|
||||
}
|
||||
|
||||
@@ -378,8 +378,8 @@ func TestRcJobList(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, out1)
|
||||
assert.Equal(t, []int64{1}, out1["jobids"], "should have job listed")
|
||||
assert.Equal(t, []int64{1}, out1["running_ids"], "should have running job")
|
||||
assert.Equal(t, []int64{}, out1["finished_ids"], "should not have finished job")
|
||||
assert.Equal(t, []int64{1}, out1["runningIds"], "should have running job")
|
||||
assert.Equal(t, []int64{}, out1["finishedIds"], "should not have finished job")
|
||||
|
||||
_, _, err = NewJob(ctx, longFn, rc.Params{"_async": true})
|
||||
assert.NoError(t, err)
|
||||
|
||||
Reference in New Issue
Block a user