forked from DavidKrau/terraform-provider-simplemdm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeviceGroup_data_source_test.go
More file actions
37 lines (31 loc) · 1.03 KB
/
deviceGroup_data_source_test.go
File metadata and controls
37 lines (31 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package provider
import (
"testing"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)
func TestAccDeviceGroupDataSource(t *testing.T) {
testAccPreCheck(t)
// Device groups cannot be created via API - they must exist
// This test requires SIMPLEMDM_DEVICE_GROUP_ID or will skip
deviceGroupID := testAccGetEnv(t, "SIMPLEMDM_DEVICE_GROUP_ID")
if deviceGroupID == "" {
t.Skip("SIMPLEMDM_DEVICE_GROUP_ID not set - skipping test as device groups cannot be created via API")
}
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
// Read existing device group with data source
{
Config: providerConfig + `
data "simplemdm_devicegroup" "test" {
id = "` + deviceGroupID + `"
}
`,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("data.simplemdm_devicegroup.test", "id", deviceGroupID),
resource.TestCheckResourceAttrSet("data.simplemdm_devicegroup.test", "name"),
),
},
},
})
}