mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 18:04:55 +01:00
fstests: make integration tests work with connection strings in remotes
This commit is contained in:
parent
3567a47258
commit
12761b3058
@ -526,23 +526,33 @@ func Run(t *testing.T, opt *Opt) {
|
|||||||
t.Run("FsName", func(t *testing.T) {
|
t.Run("FsName", func(t *testing.T) {
|
||||||
skipIfNotOk(t)
|
skipIfNotOk(t)
|
||||||
got := removeConfigID(f.Name())
|
got := removeConfigID(f.Name())
|
||||||
want := remoteName[:strings.LastIndex(remoteName, ":")+1]
|
var want string
|
||||||
if isLocalRemote {
|
if isLocalRemote {
|
||||||
want = "local:"
|
want = "local"
|
||||||
|
} else {
|
||||||
|
want = remoteName[:strings.LastIndex(remoteName, ":")]
|
||||||
|
comma := strings.IndexRune(remoteName, ',')
|
||||||
|
if comma >= 0 {
|
||||||
|
want = want[:comma]
|
||||||
}
|
}
|
||||||
require.Equal(t, want, got+":")
|
}
|
||||||
|
require.Equal(t, want, got)
|
||||||
})
|
})
|
||||||
|
|
||||||
// TestFsRoot tests the Root method
|
// TestFsRoot tests the Root method
|
||||||
t.Run("FsRoot", func(t *testing.T) {
|
t.Run("FsRoot", func(t *testing.T) {
|
||||||
skipIfNotOk(t)
|
skipIfNotOk(t)
|
||||||
name := removeConfigID(f.Name()) + ":"
|
got := f.Root()
|
||||||
root := f.Root()
|
want := subRemoteName
|
||||||
|
colon := strings.LastIndex(want, ":")
|
||||||
|
if colon >= 0 {
|
||||||
|
want = want[colon+1:]
|
||||||
|
}
|
||||||
if isLocalRemote {
|
if isLocalRemote {
|
||||||
// only check last path element on local
|
// only check last path element on local
|
||||||
require.Equal(t, filepath.Base(subRemoteName), filepath.Base(root))
|
require.Equal(t, filepath.Base(subRemoteName), filepath.Base(got))
|
||||||
} else {
|
} else {
|
||||||
require.Equal(t, subRemoteName, name+root)
|
require.Equal(t, want, got)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user