github.com/subuk/terraform@v0.6.14-0.20160317140351-de1567c2e732/rpc/ui_output_test.go (about)

     1  package rpc
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/hashicorp/terraform/terraform"
     7  )
     8  
     9  func TestUIOutput_impl(t *testing.T) {
    10  	var _ terraform.UIOutput = new(UIOutput)
    11  }
    12  
    13  func TestUIOutput_input(t *testing.T) {
    14  	client, server := testClientServer(t)
    15  	defer client.Close()
    16  
    17  	o := new(terraform.MockUIOutput)
    18  
    19  	err := server.RegisterName("UIOutput", &UIOutputServer{
    20  		UIOutput: o,
    21  	})
    22  	if err != nil {
    23  		t.Fatalf("err: %s", err)
    24  	}
    25  
    26  	output := &UIOutput{Client: client, Name: "UIOutput"}
    27  	output.Output("foo")
    28  	if !o.OutputCalled {
    29  		t.Fatal("output should be called")
    30  	}
    31  	if o.OutputMessage != "foo" {
    32  		t.Fatalf("bad: %#v", o.OutputMessage)
    33  	}
    34  }