Allow Fs tests to declare new config items
This commit is contained in:
parent
9985fc40f4
commit
b4b4b6cb1c
1 changed files with 10 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue