github.com/chalford/terraform@v0.3.7-0.20150113080010-a78c69a8c81f/builtin/providers/google/config_test.go (about)

     1  package google
     2  
     3  import (
     4  	"reflect"
     5  	"testing"
     6  )
     7  
     8  func TestConfigLoadJSON_account(t *testing.T) {
     9  	var actual accountFile
    10  	if err := loadJSON(&actual, "./test-fixtures/fake_account.json"); err != nil {
    11  		t.Fatalf("err: %s", err)
    12  	}
    13  
    14  	expected := accountFile{
    15  		PrivateKeyId: "foo",
    16  		PrivateKey:   "bar",
    17  		ClientEmail:  "foo@bar.com",
    18  		ClientId:     "id@foo.com",
    19  	}
    20  
    21  	if !reflect.DeepEqual(actual, expected) {
    22  		t.Fatalf("bad: %#v", actual)
    23  	}
    24  }
    25  
    26  func TestConfigLoadJSON_client(t *testing.T) {
    27  	var actual clientSecretsFile
    28  	if err := loadJSON(&actual, "./test-fixtures/fake_client.json"); err != nil {
    29  		t.Fatalf("err: %s", err)
    30  	}
    31  
    32  	var expected clientSecretsFile
    33  	expected.Web.AuthURI = "https://accounts.google.com/o/oauth2/auth"
    34  	expected.Web.ClientEmail = "foo@developer.gserviceaccount.com"
    35  	expected.Web.ClientId = "foo.apps.googleusercontent.com"
    36  	expected.Web.TokenURI = "https://accounts.google.com/o/oauth2/token"
    37  
    38  	if !reflect.DeepEqual(actual, expected) {
    39  		t.Fatalf("bad: %#v", actual)
    40  	}
    41  }