38 lines
763 B
Go
Raw Normal View History

2013-06-26 17:37:46 -07:00
package vagrant
import (
"strings"
2013-06-26 17:37:46 -07:00
"testing"
2017-04-04 13:39:01 -07:00
"github.com/hashicorp/packer/packer"
2013-06-26 17:37:46 -07:00
)
func TestAWSProvider_impl(t *testing.T) {
var _ Provider = new(AWSProvider)
2013-06-26 17:37:46 -07:00
}
func TestAWSProvider_KeepInputArtifact(t *testing.T) {
p := new(AWSProvider)
if !p.KeepInputArtifact() {
t.Fatal("should keep input artifact")
}
}
func TestAWSProvider_ArtifactId(t *testing.T) {
p := new(AWSProvider)
ui := testUi()
artifact := &packer.MockArtifact{
IdValue: "us-east-1:ami-1234",
}
vagrantfile, _, err := p.Process(ui, artifact, "foo")
if err != nil {
t.Fatalf("should not have error: %s", err)
}
result := `aws.region_config "us-east-1", ami: "ami-1234"`
2017-03-28 18:40:46 -07:00
if !strings.Contains(vagrantfile, result) {
t.Fatalf("wrong substitution: %s", vagrantfile)
}
}