github.com/r3vit/terraform@v0.11.9-beta1.0.20181016131357-87d05607d3c5/terraform/ui_output_provisioner_test.go (about)

     1  package terraform
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestProvisionerUIOutput_impl(t *testing.T) {
     8  	var _ UIOutput = new(ProvisionerUIOutput)
     9  }
    10  
    11  func TestProvisionerUIOutputOutput(t *testing.T) {
    12  	hook := new(MockHook)
    13  	output := &ProvisionerUIOutput{
    14  		Info:  nil,
    15  		Type:  "foo",
    16  		Hooks: []Hook{hook},
    17  	}
    18  
    19  	output.Output("bar")
    20  
    21  	if !hook.ProvisionOutputCalled {
    22  		t.Fatal("should be called")
    23  	}
    24  	if hook.ProvisionOutputProvisionerId != "foo" {
    25  		t.Fatalf("bad: %#v", hook.ProvisionOutputProvisionerId)
    26  	}
    27  	if hook.ProvisionOutputMessage != "bar" {
    28  		t.Fatalf("bad: %#v", hook.ProvisionOutputMessage)
    29  	}
    30  }