X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=mailgun%2Fresource_mailgun_domain_test.go;h=952e0132aed7ee5f85bd7e0ecbb154125d5287c0;hb=70ac6365eecfb6a88f56a46b9b7d685e6726e43c;hp=c35df48ad32ce16d9bd3b4a7a1f4a6f82b00a5da;hpb=3d14d0f6d5028255ced812725e0b2d917d32eaa6;p=github%2Ffretlink%2Fterraform-provider-mailgun.git diff --git a/mailgun/resource_mailgun_domain_test.go b/mailgun/resource_mailgun_domain_test.go index c35df48..952e013 100644 --- a/mailgun/resource_mailgun_domain_test.go +++ b/mailgun/resource_mailgun_domain_test.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" - "github.com/mailgun/mailgun-go" + "github.com/mailgun/mailgun-go/v3" "os" "strconv" "testing" @@ -105,6 +105,30 @@ func TestAccMailgunDomain_withUpdate(t *testing.T) { }) } + +func TestDomain_importBasic(t *testing.T) { + var domain fullDomain + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccDomainCheckDestroy(&domain), + Steps: []resource.TestStep{ + { + Config: interpolateTerraformTemplateDomain(testAccDomainConfig_import), + Check: resource.ComposeTestCheckFunc( + testAccDomainCheckExists("mailgun_domain.exemple",&domain), + ), + }, + { + ResourceName: "mailgun_domain.exemple", + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func testAccDomainCheckExists(rn string, domain *fullDomain) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[rn] @@ -226,3 +250,8 @@ resource "mailgun_domain" "exemple" { } ` +const testAccDomainConfig_import = ` +resource "mailgun_domain" "exemple" { + name = "%s" +} +`