github.com/bhameyie/otto@v0.2.1-0.20160406174117-16052efa52ec/helper/terraform/outputs_test.go (about)

     1  package terraform
     2  
     3  import (
     4  	"path/filepath"
     5  	"reflect"
     6  	"testing"
     7  )
     8  
     9  func TestOutputs(t *testing.T) {
    10  	cases := []struct {
    11  		Input  string
    12  		Result map[string]string
    13  		Err    bool
    14  	}{
    15  		{
    16  			"outputs-empty.tfstate",
    17  			nil,
    18  			false,
    19  		},
    20  
    21  		{
    22  			"outputs-basic.tfstate",
    23  			map[string]string{"foo": "bar"},
    24  			false,
    25  		},
    26  	}
    27  
    28  	for _, tc := range cases {
    29  		result, err := Outputs(filepath.Join("./test-fixtures", tc.Input))
    30  		if (err != nil) != tc.Err {
    31  			t.Fatalf("bad: %s, %s", tc.Input, err)
    32  		}
    33  
    34  		if !reflect.DeepEqual(result, tc.Result) {
    35  			t.Fatalf("bad: %#v", result)
    36  		}
    37  	}
    38  }