github.com/jerryclinesmith/packer@v0.3.7/builder/openstack/image_config_test.go (about)

     1  package openstack
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func testImageConfig() *ImageConfig {
     8  	return &ImageConfig{
     9  		ImageName: "foo",
    10  	}
    11  }
    12  
    13  func TestImageConfigPrepare_Region(t *testing.T) {
    14  	c := testImageConfig()
    15  	if err := c.Prepare(nil); err != nil {
    16  		t.Fatalf("shouldn't have err: %s", err)
    17  	}
    18  
    19  	c.ImageName = ""
    20  	if err := c.Prepare(nil); err == nil {
    21  		t.Fatal("should have error")
    22  	}
    23  }