local, yandex, dropbox: fix NewObject suceeding on a directory #1079

Add tests to make it consistent across all remotes
This commit is contained in:
Nick Craig-Wood
2017-02-25 11:09:57 +00:00
parent 527099ae72
commit 79e3c67bbd
20 changed files with 66 additions and 34 deletions
+10 -1
View File
@@ -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)