local, yandex, dropbox: fix NewObject suceeding on a directory #1079
Add tests to make it consistent across all remotes
This commit is contained in:
@@ -7,7 +7,6 @@ package fstests
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
@@ -21,6 +20,7 @@ import (
|
||||
|
||||
"github.com/ncw/rclone/fs"
|
||||
"github.com/ncw/rclone/fstest"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@@ -403,6 +403,15 @@ func TestFsListFile1and2(t *testing.T) {
|
||||
fstest.CheckListing(t, remote, []fstest.Item{file1, file2})
|
||||
}
|
||||
|
||||
// TestFsNewObjectDir tests NewObject on a directory which should produce an error
|
||||
func TestFsNewObjectDir(t *testing.T) {
|
||||
skipIfNotOk(t)
|
||||
dir := path.Dir(file2.Path)
|
||||
obj, err := remote.NewObject(dir)
|
||||
assert.Nil(t, obj)
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
// TestFsCopy tests Copy
|
||||
func TestFsCopy(t *testing.T) {
|
||||
skipIfNotOk(t)
|
||||
|
||||
Reference in New Issue
Block a user