github.com/rothwerx/packer@v0.9.0/builder/digitalocean/artifact_test.go (about)

     1  package digitalocean
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/mitchellh/packer/packer"
     7  )
     8  
     9  func TestArtifact_Impl(t *testing.T) {
    10  	var raw interface{}
    11  	raw = &Artifact{}
    12  	if _, ok := raw.(packer.Artifact); !ok {
    13  		t.Fatalf("Artifact should be artifact")
    14  	}
    15  }
    16  
    17  func TestArtifactId(t *testing.T) {
    18  	a := &Artifact{"packer-foobar", 42, "sfo", nil}
    19  	expected := "sfo:42"
    20  
    21  	if a.Id() != expected {
    22  		t.Fatalf("artifact ID should match: %v", expected)
    23  	}
    24  }
    25  
    26  func TestArtifactString(t *testing.T) {
    27  	a := &Artifact{"packer-foobar", 42, "sfo", nil}
    28  	expected := "A snapshot was created: 'packer-foobar' (ID: 42) in region 'sfo'"
    29  
    30  	if a.String() != expected {
    31  		t.Fatalf("artifact string should match: %v", expected)
    32  	}
    33  }