github.com/peterbale/terraform@v0.9.0-beta2.0.20170315142748-5723acd55547/builtin/providers/azurerm/import_arm_eventhub_authorization_rule_test.go (about) 1 package azurerm 2 3 import ( 4 "testing" 5 6 "fmt" 7 8 "github.com/hashicorp/terraform/helper/acctest" 9 "github.com/hashicorp/terraform/helper/resource" 10 ) 11 12 func TestAccAzureRMEventHubAuthorizationRule_importListen(t *testing.T) { 13 resourceName := "azurerm_eventhub_authorization_rule.test" 14 15 ri := acctest.RandInt() 16 config := fmt.Sprintf(testAccAzureRMEventHubAuthorizationRule_listen, ri, ri, ri, ri) 17 18 resource.Test(t, resource.TestCase{ 19 PreCheck: func() { testAccPreCheck(t) }, 20 Providers: testAccProviders, 21 CheckDestroy: testCheckAzureRMEventHubAuthorizationRuleDestroy, 22 Steps: []resource.TestStep{ 23 { 24 Config: config, 25 }, 26 27 { 28 ResourceName: resourceName, 29 ImportState: true, 30 ImportStateVerify: true, 31 }, 32 }, 33 }) 34 } 35 36 func TestAccAzureRMEventHubAuthorizationRule_importSend(t *testing.T) { 37 resourceName := "azurerm_eventhub_authorization_rule.test" 38 39 ri := acctest.RandInt() 40 config := fmt.Sprintf(testAccAzureRMEventHubAuthorizationRule_send, ri, ri, ri, ri) 41 42 resource.Test(t, resource.TestCase{ 43 PreCheck: func() { testAccPreCheck(t) }, 44 Providers: testAccProviders, 45 CheckDestroy: testCheckAzureRMEventHubAuthorizationRuleDestroy, 46 Steps: []resource.TestStep{ 47 { 48 Config: config, 49 }, 50 51 { 52 ResourceName: resourceName, 53 ImportState: true, 54 ImportStateVerify: true, 55 }, 56 }, 57 }) 58 } 59 60 func TestAccAzureRMEventHubAuthorizationRule_importReadWrite(t *testing.T) { 61 resourceName := "azurerm_eventhub_authorization_rule.test" 62 63 ri := acctest.RandInt() 64 config := fmt.Sprintf(testAccAzureRMEventHubAuthorizationRule_readwrite, ri, ri, ri, ri) 65 66 resource.Test(t, resource.TestCase{ 67 PreCheck: func() { testAccPreCheck(t) }, 68 Providers: testAccProviders, 69 CheckDestroy: testCheckAzureRMEventHubAuthorizationRuleDestroy, 70 Steps: []resource.TestStep{ 71 { 72 Config: config, 73 }, 74 75 { 76 ResourceName: resourceName, 77 ImportState: true, 78 ImportStateVerify: true, 79 }, 80 }, 81 }) 82 } 83 84 func TestAccAzureRMEventHubAuthorizationRule_importManage(t *testing.T) { 85 resourceName := "azurerm_eventhub_authorization_rule.test" 86 87 ri := acctest.RandInt() 88 config := fmt.Sprintf(testAccAzureRMEventHubAuthorizationRule_manage, ri, ri, ri, ri) 89 90 resource.Test(t, resource.TestCase{ 91 PreCheck: func() { testAccPreCheck(t) }, 92 Providers: testAccProviders, 93 CheckDestroy: testCheckAzureRMEventHubAuthorizationRuleDestroy, 94 Steps: []resource.TestStep{ 95 { 96 Config: config, 97 }, 98 99 { 100 ResourceName: resourceName, 101 ImportState: true, 102 ImportStateVerify: true, 103 }, 104 }, 105 }) 106 }