From b4b4b6cb1cdc40cbf8ac813406d32f2156f42f91 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Sat, 20 Aug 2016 16:25:14 +0100 Subject: [PATCH] Allow Fs tests to declare new config items --- fstest/fstests/fstests.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fstest/fstests/fstests.go b/fstest/fstests/fstests.go index f694359b1..eb167e7c1 100644 --- a/fstest/fstests/fstests.go +++ b/fstest/fstests/fstests.go @@ -31,7 +31,9 @@ var ( subRemoteLeaf = "" // NilObject should be set to a nil Object from the Fs under test NilObject fs.Object - file1 = fstest.Item{ + // ExtraConfig is for adding config to a remote + ExtraConfig = []ExtraConfigItem{} + file1 = fstest.Item{ ModTime: fstest.Time("2001-02-03T04:05:06.499999999Z"), Path: "file name.txt", } @@ -45,6 +47,9 @@ var ( dumpBodies = flag.Bool("dump-bodies", false, "Dump HTTP headers and bodies - may contain sensitive info") ) +// ExtraConfigItem describes a config item added on the fly while testing +type ExtraConfigItem struct{ Name, Key, Value string } + const eventualConsistencyRetries = 10 func init() { @@ -60,6 +65,10 @@ func TestInit(t *testing.T) { // "RCLONE_CONFIG_PASS=hunter2" (or your password) *fs.AskPassword = false fs.LoadConfig() + // Set extra config if supplied + for _, item := range ExtraConfig { + fs.ConfigFile.SetValue(item.Name, item.Key, item.Value) + } fs.Config.Verbose = *verbose fs.Config.Quiet = !*verbose fs.Config.DumpHeaders = *dumpHeaders