packer-cn/builder/virtualbox/common/vboxbundle_config_test.go
Adrien Delorme c11ef90cb6 use interpolate.NewContext() instead of testConfigTemplate(t)
because it's what's happenning there
2019-06-14 12:17:28 +02:00

38 lines
697 B
Go

package common
import (
"reflect"
"testing"
"github.com/hashicorp/packer/template/interpolate"
)
func TestVBoxBundleConfigPrepare_VBoxBundle(t *testing.T) {
// Test with empty
c := new(VBoxBundleConfig)
errs := c.Prepare(interpolate.NewContext())
if len(errs) > 0 {
t.Fatalf("err: %#v", errs)
}
if !reflect.DeepEqual(*c, VBoxBundleConfig{BundleISO: false}) {
t.Fatalf("bad: %#v", c)
}
// Test with a good one
c = new(VBoxBundleConfig)
c.BundleISO = true
errs = c.Prepare(interpolate.NewContext())
if len(errs) > 0 {
t.Fatalf("err: %#v", errs)
}
expected := VBoxBundleConfig{
BundleISO: true,
}
if !reflect.DeepEqual(*c, expected) {
t.Fatalf("bad: %#v", c)
}
}