mirror of
https://github.com/rclone/rclone.git
synced 2025-08-19 01:46:31 +02:00
config: add --obscure and --no-obscure flags to config create/update
Before this change there was some ambiguity about whether passwords were obscured on not passing them into config create or config update. This change adds the --obscure and --no-obscure flags to make the intent clear. It also updates the remote control and the tests. Fixes #3728
This commit is contained in:
@@ -101,11 +101,12 @@ func TestRc(t *testing.T) {
|
||||
t.Run("Password", func(t *testing.T) {
|
||||
call := rc.Calls.Get("config/password")
|
||||
assert.NotNil(t, call)
|
||||
pw2 := obscure.MustObscure("password")
|
||||
in := rc.Params{
|
||||
"name": testName,
|
||||
"parameters": rc.Params{
|
||||
"test_key": "rutabaga",
|
||||
"test_key2": "cabbage",
|
||||
"test_key2": pw2, // check we encode an already encoded password
|
||||
},
|
||||
}
|
||||
out, err := call.Fn(context.Background(), in)
|
||||
@@ -114,7 +115,7 @@ func TestRc(t *testing.T) {
|
||||
|
||||
assert.Equal(t, "local", config.FileGet(testName, "type"))
|
||||
assert.Equal(t, "rutabaga", obscure.MustReveal(config.FileGet(testName, "test_key")))
|
||||
assert.Equal(t, "cabbage", obscure.MustReveal(config.FileGet(testName, "test_key2")))
|
||||
assert.Equal(t, pw2, obscure.MustReveal(config.FileGet(testName, "test_key2")))
|
||||
})
|
||||
|
||||
// Delete the test remote
|
||||
|
Reference in New Issue
Block a user