github.com/IBM-Cloud/terraform@v0.6.4-0.20170726051544-8872b87621df/builtin/providers/pagerduty/import_pagerduty_service_integration_test.go (about)

     1  package pagerduty
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  
     7  	"github.com/hashicorp/terraform/helper/acctest"
     8  	"github.com/hashicorp/terraform/helper/resource"
     9  )
    10  
    11  func TestAccPagerDutyServiceIntegration_import(t *testing.T) {
    12  	username := fmt.Sprintf("tf-%s", acctest.RandString(5))
    13  	email := fmt.Sprintf("%s@foo.com", username)
    14  	escalationPolicy := fmt.Sprintf("tf-%s", acctest.RandString(5))
    15  	service := fmt.Sprintf("tf-%s", acctest.RandString(5))
    16  	serviceIntegration := fmt.Sprintf("tf-%s", acctest.RandString(5))
    17  
    18  	resource.Test(t, resource.TestCase{
    19  		PreCheck:     func() { testAccPreCheck(t) },
    20  		Providers:    testAccProviders,
    21  		CheckDestroy: testAccCheckPagerDutyServiceIntegrationDestroy,
    22  		Steps: []resource.TestStep{
    23  			{
    24  				Config: testAccCheckPagerDutyServiceIntegrationConfig(username, email, escalationPolicy, service, serviceIntegration),
    25  			},
    26  
    27  			{
    28  				ResourceName:      "pagerduty_service_integration.foo",
    29  				ImportState:       true,
    30  				ImportStateVerify: true,
    31  			},
    32  		},
    33  	})
    34  }