github.com/phobos182/packer@v0.2.3-0.20130819023704-c84d2aeffc68/builder/amazon/common/artifact_test.go (about) 1 package common 2 3 import ( 4 "cgl.tideland.biz/asserts" 5 "github.com/mitchellh/packer/packer" 6 "testing" 7 ) 8 9 func TestArtifact_Impl(t *testing.T) { 10 assert := asserts.NewTestingAsserts(t, true) 11 12 var actual packer.Artifact 13 assert.Implementor(&Artifact{}, &actual, "should be an Artifact") 14 } 15 16 func TestArtifactId(t *testing.T) { 17 assert := asserts.NewTestingAsserts(t, true) 18 19 expected := `east:foo,west:bar` 20 21 amis := make(map[string]string) 22 amis["east"] = "foo" 23 amis["west"] = "bar" 24 25 a := &Artifact{ 26 Amis: amis, 27 } 28 29 result := a.Id() 30 assert.Equal(result, expected, "should match output") 31 } 32 33 func TestArtifactString(t *testing.T) { 34 assert := asserts.NewTestingAsserts(t, true) 35 36 expected := `AMIs were created: 37 38 east: foo 39 west: bar` 40 41 amis := make(map[string]string) 42 amis["east"] = "foo" 43 amis["west"] = "bar" 44 45 a := &Artifact{Amis: amis} 46 result := a.String() 47 assert.Equal(result, expected, "should match output") 48 }