Files
podman/pkg/domain/utils/scp_test.go
Matt Heon 72f1617fac Bump Go module to v5
Moving from Go module v4 to v5 prepares us for public releases.

Move done using gomove [1] as with the v3 and v4 moves.

[1] https://github.com/KSubedi/gomove

Signed-off-by: Matt Heon <mheon@redhat.com>
2024-02-08 09:35:39 -05:00

75 lines
1.3 KiB
Go

package utils
import (
"fmt"
"testing"
"github.com/containers/podman/v5/pkg/domain/entities"
"github.com/stretchr/testify/assert"
)
func TestValidateSCPArgs(t *testing.T) {
type args struct {
locations []*entities.ImageScpOptions
}
tests := []struct {
name string
args args
wantErr assert.ErrorAssertionFunc
}{
{
name: "test args length more than 2",
args: args{
locations: []*entities.ImageScpOptions{
{
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.ImageScpOptions{
{
Image: "",
},
{
Image: "target image",
},
},
},
wantErr: assert.NoError,
},
{
name: "test target image is empty",
args: args{
locations: []*entities.ImageScpOptions{
{
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))
})
}
}