packer-cn/builder/digitalocean/step_create_droplet_test.go

27 lines
542 B
Go
Raw Normal View History

2020-05-13 13:29:22 -04:00
package digitalocean
import (
"testing"
"github.com/digitalocean/godo"
)
func TestBuilder_GetImageType(t *testing.T) {
imageTypeTests := []struct {
in string
out godo.DropletCreateImage
}{
{"ubuntu-20-04-x64", godo.DropletCreateImage{Slug: "ubuntu-20-04-x64"}},
{"123456", godo.DropletCreateImage{ID: 123456}},
}
for _, tt := range imageTypeTests {
t.Run(tt.in, func(t *testing.T) {
i := getImageType(tt.in)
if i != tt.out {
t.Errorf("got %q, want %q", godo.Stringify(i), godo.Stringify(tt.out))
}
})
}
}