浏览代码

minor fixes

Nicola Murino 5 年之前
父节点
当前提交
3ac5af47f2
共有 2 个文件被更改,包括 8 次插入5 次删除
  1. 1 1
      dataprovider/user.go
  2. 7 4
      sftpd/sftpd_test.go

+ 1 - 1
dataprovider/user.go

@@ -32,7 +32,7 @@ const (
 	PermCreateSymlinks = "create_symlinks"
 	PermCreateSymlinks = "create_symlinks"
 	// changing file or directory permissions is allowed
 	// changing file or directory permissions is allowed
 	PermChmod = "chmod"
 	PermChmod = "chmod"
-	// changing file or directory owner is allowed
+	// changing file or directory owner and group is allowed
 	PermChown = "chown"
 	PermChown = "chown"
 )
 )
 
 

+ 7 - 4
sftpd/sftpd_test.go

@@ -499,6 +499,9 @@ func TestLink(t *testing.T) {
 func TestStat(t *testing.T) {
 func TestStat(t *testing.T) {
 	usePubKey := false
 	usePubKey := false
 	user, _, err := httpd.AddUser(getTestUser(usePubKey), http.StatusOK)
 	user, _, err := httpd.AddUser(getTestUser(usePubKey), http.StatusOK)
+	if err != nil {
+		t.Errorf("unable to add user: %v", err)
+	}
 	client, err := getSftpClient(user, usePubKey)
 	client, err := getSftpClient(user, usePubKey)
 	if err != nil {
 	if err != nil {
 		t.Errorf("unable to create sftp client: %v", err)
 		t.Errorf("unable to create sftp client: %v", err)
@@ -507,10 +510,7 @@ func TestStat(t *testing.T) {
 		testFileName := "test_file.dat"
 		testFileName := "test_file.dat"
 		testFilePath := filepath.Join(homeBasePath, testFileName)
 		testFilePath := filepath.Join(homeBasePath, testFileName)
 		testFileSize := int64(65535)
 		testFileSize := int64(65535)
-		err = createTestFile(testFilePath, testFileSize)
-		if err != nil {
-			t.Errorf("unable to create test file: %v", err)
-		}
+		createTestFile(testFilePath, testFileSize)
 		err = sftpUploadFile(testFilePath, testFileName, testFileSize, client)
 		err = sftpUploadFile(testFilePath, testFileName, testFileSize, client)
 		if err != nil {
 		if err != nil {
 			t.Errorf("file upload error: %v", err)
 			t.Errorf("file upload error: %v", err)
@@ -558,6 +558,9 @@ func TestStat(t *testing.T) {
 		}
 		}
 	}
 	}
 	_, err = httpd.RemoveUser(user, http.StatusOK)
 	_, err = httpd.RemoveUser(user, http.StatusOK)
+	if err != nil {
+		t.Errorf("unable to remove user: %v", err)
+	}
 	os.RemoveAll(user.GetHomeDir())
 	os.RemoveAll(user.GetHomeDir())
 }
 }