45 lines
704 B
Go
45 lines
704 B
Go
package common
|
|
|
|
import (
|
|
"github.com/mitchellh/packer/packer"
|
|
"testing"
|
|
)
|
|
|
|
func TestArtifact_Impl(t *testing.T) {
|
|
var _ packer.Artifact = new(Artifact)
|
|
}
|
|
|
|
func TestArtifactId(t *testing.T) {
|
|
expected := `east:foo,west:bar`
|
|
|
|
amis := make(map[string]string)
|
|
amis["east"] = "foo"
|
|
amis["west"] = "bar"
|
|
|
|
a := &Artifact{
|
|
Amis: amis,
|
|
}
|
|
|
|
result := a.Id()
|
|
if result != expected {
|
|
t.Fatalf("bad: %s", result)
|
|
}
|
|
}
|
|
|
|
func TestArtifactString(t *testing.T) {
|
|
expected := `AMIs were created:
|
|
|
|
east: foo
|
|
west: bar`
|
|
|
|
amis := make(map[string]string)
|
|
amis["east"] = "foo"
|
|
amis["west"] = "bar"
|
|
|
|
a := &Artifact{Amis: amis}
|
|
result := a.String()
|
|
if result != expected {
|
|
t.Fatalf("bad: %s", result)
|
|
}
|
|
}
|