From 07af258415aa718dd7f99f11208c5d77102d0c56 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 12 Feb 2019 10:59:36 -0800 Subject: [PATCH] [Terraform] Fix config's defaultScopes tests. (#3036) Signed-off-by: Modular Magician --- google/config_test.go | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/google/config_test.go b/google/config_test.go index 8d6bbabe..ffe60699 100644 --- a/google/config_test.go +++ b/google/config_test.go @@ -118,16 +118,22 @@ func TestAccConfigLoadValidate_accessToken(t *testing.T) { } } -func TestConfigLoadAndValidate_defaultScopes(t *testing.T) { - config := Config{} +func TestConfigLoadAndValidate_customScopes(t *testing.T) { + config := Config{ + Credentials: testFakeCredentialsPath, + Project: "my-gce-project", + Region: "us-central1", + Scopes: []string{"https://www.googleapis.com/auth/compute"}, + } err := config.loadAndValidate() if err != nil { t.Fatalf("unexpected error: %v", err) } - for index, scope := range defaultClientScopes { - if config.Scopes[index] != scope { - t.Fatalf("Unexpected default client scopes: %v, index %d", config.Scopes[index], index) - } + if len(config.Scopes) != 1 { + t.Fatalf("expected 1 scope, got %d scopes: %v", len(config.Scopes), config.Scopes) + } + if config.Scopes[0] != "https://www.googleapis.com/auth/compute" { + t.Fatalf("expected scope to be %q, got %q", "https://www.googleapis.com/auth/compute", config.Scopes[0]) } }