github.com/rahart/packer@v0.12.2-0.20161229105310-282bb6ad370f/post-processor/vagrant/aws_test.go (about)

     1  package vagrant
     2  
     3  import (
     4  	"strings"
     5  	"testing"
     6  
     7  	"github.com/mitchellh/packer/packer"
     8  )
     9  
    10  func TestAWSProvider_impl(t *testing.T) {
    11  	var _ Provider = new(AWSProvider)
    12  }
    13  
    14  func TestAWSProvider_KeepInputArtifact(t *testing.T) {
    15  	p := new(AWSProvider)
    16  
    17  	if !p.KeepInputArtifact() {
    18  		t.Fatal("should keep input artifact")
    19  	}
    20  }
    21  
    22  func TestAWSProvider_ArtifactId(t *testing.T) {
    23  	p := new(AWSProvider)
    24  	ui := testUi()
    25  	artifact := &packer.MockArtifact{
    26  		IdValue: "us-east-1:ami-1234",
    27  	}
    28  
    29  	vagrantfile, _, err := p.Process(ui, artifact, "foo")
    30  	if err != nil {
    31  		t.Fatalf("should not have error: %s", err)
    32  	}
    33  	result := `aws.region_config "us-east-1", ami: "ami-1234"`
    34  	if strings.Index(vagrantfile, result) == -1 {
    35  		t.Fatalf("wrong substitution: %s", vagrantfile)
    36  	}
    37  }