forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issue-10386 (GoogleCloudPlatform#5461)
- Loading branch information
1 parent
b7a90a9
commit c139ff4
Showing
2 changed files
with
78 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
mmv1/third_party/terraform/tests/resource_essential_contacts_contact_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package google | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
) | ||
|
||
func TestAccEssentialContactsContact_update(t *testing.T) { | ||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"random_suffix": randString(t, 10), | ||
} | ||
|
||
vcrTest(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testAccCheckEssentialContactsContactDestroyProducer(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccEssentialContactsContact_v1(context), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("google_essential_contacts_contact.contact", | ||
"email", "[email protected]"), | ||
), | ||
}, | ||
{ | ||
ResourceName: "google_essential_contacts_contact.contact", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"parent"}, | ||
}, | ||
{ | ||
Config: testAccEssentialContactsContact_v2(context), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr("google_essential_contacts_contact.contact", | ||
"email", "[email protected]"), | ||
), | ||
}, | ||
{ | ||
ResourceName: "google_essential_contacts_contact.contact", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"parent"}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccEssentialContactsContact_v1(context map[string]interface{}) string { | ||
return Nprintf(` | ||
data "google_project" "project" { | ||
} | ||
resource "google_essential_contacts_contact" "contact" { | ||
parent = data.google_project.project.id | ||
email = "[email protected]" | ||
language_tag = "en-GB" | ||
notification_category_subscriptions = ["ALL"] | ||
} | ||
`, context) | ||
} | ||
|
||
func testAccEssentialContactsContact_v2(context map[string]interface{}) string { | ||
return Nprintf(` | ||
data "google_project" "project" { | ||
} | ||
resource "google_essential_contacts_contact" "contact" { | ||
parent = data.google_project.project.id | ||
email = "[email protected]" | ||
language_tag = "en-GB" | ||
notification_category_subscriptions = ["ALL"] | ||
} | ||
`, context) | ||
} |