2013-07-20 23:08:41 -04:00
|
|
|
package common
|
2013-05-22 01:28:41 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/mitchellh/packer/packer"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestArtifact_Impl(t *testing.T) {
|
2013-10-16 22:29:53 -04:00
|
|
|
var _ packer.Artifact = new(Artifact)
|
2013-05-22 01:28:41 -04:00
|
|
|
}
|
|
|
|
|
2013-06-26 20:40:21 -04:00
|
|
|
func TestArtifactId(t *testing.T) {
|
|
|
|
expected := `east:foo,west:bar`
|
|
|
|
|
|
|
|
amis := make(map[string]string)
|
|
|
|
amis["east"] = "foo"
|
|
|
|
amis["west"] = "bar"
|
|
|
|
|
2013-07-22 01:46:11 -04:00
|
|
|
a := &Artifact{
|
|
|
|
Amis: amis,
|
|
|
|
}
|
|
|
|
|
2013-06-26 20:40:21 -04:00
|
|
|
result := a.Id()
|
2013-10-16 22:29:53 -04:00
|
|
|
if result != expected {
|
|
|
|
t.Fatalf("bad: %s", result)
|
|
|
|
}
|
2013-06-26 20:40:21 -04:00
|
|
|
}
|
|
|
|
|
2013-05-22 01:28:41 -04:00
|
|
|
func TestArtifactString(t *testing.T) {
|
|
|
|
expected := `AMIs were created:
|
|
|
|
|
|
|
|
east: foo
|
|
|
|
west: bar`
|
|
|
|
|
|
|
|
amis := make(map[string]string)
|
|
|
|
amis["east"] = "foo"
|
|
|
|
amis["west"] = "bar"
|
|
|
|
|
2013-07-22 01:46:11 -04:00
|
|
|
a := &Artifact{Amis: amis}
|
2013-05-22 01:28:41 -04:00
|
|
|
result := a.String()
|
2013-10-16 22:29:53 -04:00
|
|
|
if result != expected {
|
|
|
|
t.Fatalf("bad: %s", result)
|
|
|
|
}
|
2013-05-22 01:28:41 -04:00
|
|
|
}
|