2018-02-26 11:47:59 -05:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"reflect"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestVBoxBundleConfigPrepare_VBoxBundle(t *testing.T) {
|
|
|
|
// Test with empty
|
|
|
|
c := new(VBoxBundleConfig)
|
|
|
|
errs := c.Prepare(testConfigTemplate(t))
|
|
|
|
if len(errs) > 0 {
|
|
|
|
t.Fatalf("err: %#v", errs)
|
|
|
|
}
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(c, VBoxBundleConfig{BundleISO: false}) {
|
2018-03-08 18:30:38 -05:00
|
|
|
t.Fatalf("bad: %#v", c.BundleISO)
|
2018-02-26 11:47:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// Test with a good one
|
|
|
|
c = new(VBoxBundleConfig)
|
|
|
|
c.BundleISO = true
|
|
|
|
errs = c.Prepare(testConfigTemplate(t))
|
|
|
|
if len(errs) > 0 {
|
|
|
|
t.Fatalf("err: %#v", errs)
|
|
|
|
}
|
|
|
|
|
|
|
|
expected := VBoxBundleConfig{
|
2018-03-07 12:02:30 -05:00
|
|
|
BundleISO: true,
|
2018-02-26 11:47:59 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if !reflect.DeepEqual(c, expected) {
|
|
|
|
t.Fatalf("bad: %#v", c)
|
|
|
|
}
|
|
|
|
}
|