github.com/phobos182/packer@v0.2.3-0.20130819023704-c84d2aeffc68/builder/amazon/common/ami_config_test.go (about) 1 package common 2 3 import ( 4 "testing" 5 ) 6 7 func testAMIConfig() *AMIConfig { 8 return &AMIConfig{ 9 AMIName: "foo", 10 } 11 } 12 13 func TestAMIConfigPrepare_Region(t *testing.T) { 14 c := testAMIConfig() 15 if err := c.Prepare(nil); err != nil { 16 t.Fatalf("shouldn't have err: %s", err) 17 } 18 19 c.AMIName = "" 20 if err := c.Prepare(nil); err == nil { 21 t.Fatal("should have error") 22 } 23 }