github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/builtin/providers/opc/import_ssh_key_test.go (about)

     1  package opc
     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 TestAccOPCSSHKey_importBasic(t *testing.T) {
    12  	resourceName := "opc_compute_ssh_key.test"
    13  
    14  	ri := acctest.RandInt()
    15  	config := fmt.Sprintf(testAccOPCSSHKeyBasic, ri)
    16  
    17  	resource.Test(t, resource.TestCase{
    18  		PreCheck: func() {
    19  			testAccPreCheck(t)
    20  		},
    21  		Providers:    testAccProviders,
    22  		CheckDestroy: testAccOPCCheckSSHKeyDestroy,
    23  		Steps: []resource.TestStep{
    24  			{
    25  				Config: config,
    26  			},
    27  			{
    28  				ResourceName:      resourceName,
    29  				ImportState:       true,
    30  				ImportStateVerify: true,
    31  			},
    32  		},
    33  	})
    34  }
    35  
    36  func TestAccOPCSSHKey_importDisabled(t *testing.T) {
    37  	resourceName := "opc_compute_ssh_key.test"
    38  
    39  	ri := acctest.RandInt()
    40  	config := fmt.Sprintf(testAccOPCSSHKeyDisabled, ri)
    41  
    42  	resource.Test(t, resource.TestCase{
    43  		PreCheck: func() {
    44  			testAccPreCheck(t)
    45  		},
    46  		Providers:    testAccProviders,
    47  		CheckDestroy: testAccOPCCheckSSHKeyDestroy,
    48  		Steps: []resource.TestStep{
    49  			{
    50  				Config: config,
    51  			},
    52  			{
    53  				ResourceName:      resourceName,
    54  				ImportState:       true,
    55  				ImportStateVerify: true,
    56  			},
    57  		},
    58  	})
    59  }