github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/builtin/providers/profitbricks/data_source_image_test.go (about) 1 package profitbricks 2 3 import ( 4 "github.com/hashicorp/terraform/helper/resource" 5 "testing" 6 ) 7 8 func TestAccDataSourceImage_basic(t *testing.T) { 9 resource.Test(t, resource.TestCase{ 10 PreCheck: func() { 11 testAccPreCheck(t) 12 }, 13 Providers: testAccProviders, 14 Steps: []resource.TestStep{ 15 { 16 17 Config: testAccDataSourceProfitBricksImage_basic, 18 Check: resource.ComposeTestCheckFunc( 19 resource.TestCheckResourceAttr("data.profitbricks_image.img", "location", "us/las"), 20 resource.TestCheckResourceAttr("data.profitbricks_image.img", "name", "Ubuntu-16.04-LTS-server-2017-02-01"), 21 resource.TestCheckResourceAttr("data.profitbricks_image.img", "type", "HDD"), 22 ), 23 }, 24 }, 25 }) 26 27 } 28 29 const testAccDataSourceProfitBricksImage_basic = ` 30 data "profitbricks_image" "img" { 31 name = "Ubuntu" 32 type = "HDD" 33 version = "16" 34 location = "us/las" 35 } 36 `