mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
config: fix test failure on local machine with a config file
This uses a temporary config file instead.
This commit is contained in:
@@ -3,6 +3,7 @@ package config_test
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
_ "github.com/rclone/rclone/backend/local"
|
_ "github.com/rclone/rclone/backend/local"
|
||||||
@@ -19,6 +20,12 @@ const testName = "configTestNameForRc"
|
|||||||
|
|
||||||
func TestRc(t *testing.T) {
|
func TestRc(t *testing.T) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
oldConfigFile := config.GetConfigPath()
|
||||||
|
defer func() {
|
||||||
|
require.NoError(t, config.SetConfigPath(oldConfigFile))
|
||||||
|
}()
|
||||||
|
// Set a temporary config file
|
||||||
|
require.NoError(t, config.SetConfigPath(filepath.Join(t.TempDir(), "rclone.conf")))
|
||||||
configfile.Install()
|
configfile.Install()
|
||||||
// Create the test remote
|
// Create the test remote
|
||||||
call := rc.Calls.Get("config/create")
|
call := rc.Calls.Get("config/create")
|
||||||
|
|||||||
Reference in New Issue
Block a user