mirror of
https://github.com/containers/podman.git
synced 2025-11-29 17:48:05 +08:00
Tremendous amount of changes in here, but all should amount to the same thing: changing Go import paths from v5 to v6. Also bumped go.mod to github.com/containers/podman/v6 and updated version to v6.0.0-dev. Signed-off-by: Matt Heon <mheon@redhat.com>
75 lines
1.3 KiB
Go
75 lines
1.3 KiB
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/containers/podman/v6/pkg/domain/entities"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestValidateSCPArgs(t *testing.T) {
|
|
type args struct {
|
|
locations []*entities.ScpTransferImageOptions
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
wantErr assert.ErrorAssertionFunc
|
|
}{
|
|
{
|
|
name: "test args length more than 2",
|
|
args: args{
|
|
locations: []*entities.ScpTransferImageOptions{
|
|
{
|
|
Image: "source image one",
|
|
},
|
|
{
|
|
Image: "source image two",
|
|
},
|
|
{
|
|
Image: "target image one",
|
|
},
|
|
{
|
|
Image: "target image two",
|
|
},
|
|
},
|
|
},
|
|
wantErr: assert.Error,
|
|
},
|
|
{
|
|
name: "test source image is empty",
|
|
args: args{
|
|
locations: []*entities.ScpTransferImageOptions{
|
|
{
|
|
Image: "",
|
|
},
|
|
{
|
|
Image: "target image",
|
|
},
|
|
},
|
|
},
|
|
wantErr: assert.NoError,
|
|
},
|
|
{
|
|
name: "test target image is empty",
|
|
args: args{
|
|
locations: []*entities.ScpTransferImageOptions{
|
|
{
|
|
Image: "source image",
|
|
},
|
|
{
|
|
Image: "target image",
|
|
},
|
|
},
|
|
},
|
|
wantErr: assert.NoError,
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
tt.wantErr(t, ValidateSCPArgs(tt.args.locations), fmt.Sprintf("ValidateSCPArgs(%v)", tt.args.locations))
|
|
})
|
|
}
|
|
}
|