|
@@ -35,38 +35,39 @@ func TestNewActionNotification(t *testing.T) {
|
|
|
user.FsConfig.SFTPConfig = vfs.SFTPFsConfig{
|
|
|
Endpoint: "sftpendpoint",
|
|
|
}
|
|
|
- a := newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSFTP, 123, errors.New("fake error"))
|
|
|
+ a := newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSFTP, 123, 0, errors.New("fake error"))
|
|
|
assert.Equal(t, user.Username, a.Username)
|
|
|
assert.Equal(t, 0, len(a.Bucket))
|
|
|
assert.Equal(t, 0, len(a.Endpoint))
|
|
|
assert.Equal(t, 0, a.Status)
|
|
|
|
|
|
user.FsConfig.Provider = vfs.S3FilesystemProvider
|
|
|
- a = newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSSH, 123, nil)
|
|
|
+ a = newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSSH, 123, 0, nil)
|
|
|
assert.Equal(t, "s3bucket", a.Bucket)
|
|
|
assert.Equal(t, "endpoint", a.Endpoint)
|
|
|
assert.Equal(t, 1, a.Status)
|
|
|
|
|
|
user.FsConfig.Provider = vfs.GCSFilesystemProvider
|
|
|
- a = newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSCP, 123, ErrQuotaExceeded)
|
|
|
+ a = newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSCP, 123, 0, ErrQuotaExceeded)
|
|
|
assert.Equal(t, "gcsbucket", a.Bucket)
|
|
|
assert.Equal(t, 0, len(a.Endpoint))
|
|
|
assert.Equal(t, 2, a.Status)
|
|
|
|
|
|
user.FsConfig.Provider = vfs.AzureBlobFilesystemProvider
|
|
|
- a = newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSCP, 123, nil)
|
|
|
+ a = newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSCP, 123, 0, nil)
|
|
|
assert.Equal(t, "azcontainer", a.Bucket)
|
|
|
assert.Equal(t, "azsasurl", a.Endpoint)
|
|
|
assert.Equal(t, 1, a.Status)
|
|
|
|
|
|
user.FsConfig.AzBlobConfig.SASURL = ""
|
|
|
- a = newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSCP, 123, nil)
|
|
|
+ a = newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSCP, 123, os.O_APPEND, nil)
|
|
|
assert.Equal(t, "azcontainer", a.Bucket)
|
|
|
assert.Equal(t, "azendpoint", a.Endpoint)
|
|
|
assert.Equal(t, 1, a.Status)
|
|
|
+ assert.Equal(t, os.O_APPEND, a.OpenFlags)
|
|
|
|
|
|
user.FsConfig.Provider = vfs.SFTPFilesystemProvider
|
|
|
- a = newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSFTP, 123, nil)
|
|
|
+ a = newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSFTP, 123, 0, nil)
|
|
|
assert.Equal(t, "sftpendpoint", a.Endpoint)
|
|
|
}
|
|
|
|
|
@@ -80,7 +81,7 @@ func TestActionHTTP(t *testing.T) {
|
|
|
user := &dataprovider.User{
|
|
|
Username: "username",
|
|
|
}
|
|
|
- a := newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSFTP, 123, nil)
|
|
|
+ a := newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSFTP, 123, 0, nil)
|
|
|
err := actionHandler.Handle(a)
|
|
|
assert.NoError(t, err)
|
|
|
|
|
@@ -113,7 +114,7 @@ func TestActionCMD(t *testing.T) {
|
|
|
user := &dataprovider.User{
|
|
|
Username: "username",
|
|
|
}
|
|
|
- a := newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSFTP, 123, nil)
|
|
|
+ a := newActionNotification(user, operationDownload, "path", "vpath", "target", "", ProtocolSFTP, 123, 0, nil)
|
|
|
err = actionHandler.Handle(a)
|
|
|
assert.NoError(t, err)
|
|
|
|
|
@@ -137,7 +138,7 @@ func TestWrongActions(t *testing.T) {
|
|
|
Username: "username",
|
|
|
}
|
|
|
|
|
|
- a := newActionNotification(user, operationUpload, "", "", "", "", ProtocolSFTP, 123, nil)
|
|
|
+ a := newActionNotification(user, operationUpload, "", "", "", "", ProtocolSFTP, 123, 0, nil)
|
|
|
err := actionHandler.Handle(a)
|
|
|
assert.Error(t, err, "action with bad command must fail")
|
|
|
|