simplify scp upload code and add some test cases

This commit is contained in:
Nicola Murino
2019-08-24 22:44:01 +02:00
parent e50c521c33
commit 1c5aac0dc4
3 changed files with 38 additions and 21 deletions

View File

@@ -275,6 +275,10 @@ func TestDirCommands(t *testing.T) {
if err != nil {
t.Errorf("error mkdir all: %v", err)
}
_, err = client.ReadDir("/this/dir/does/not/exist")
if err == nil {
t.Errorf("reading a missing dir must fail")
}
testFileName := "/test_file.dat"
testFilePath := filepath.Join(homeBasePath, testFileName)
testFileSize := int64(65535)
@@ -334,6 +338,10 @@ func TestSymlink(t *testing.T) {
if err != nil {
t.Errorf("error creating symlink: %v", err)
}
_, err = client.ReadLink(testFileName + ".link")
if err == nil {
t.Errorf("readlink is currently not implemented so must fail")
}
err = client.Symlink(testFileName, testFileName+".link")
if err == nil {
t.Errorf("creating a symlink to an existing one must fail")