forked from DavidKrau/terraform-provider-simplemdm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanagedConfigs_data_source_test.go
More file actions
50 lines (43 loc) · 2.01 KB
/
managedConfigs_data_source_test.go
File metadata and controls
50 lines (43 loc) · 2.01 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
38
39
40
41
42
43
44
45
46
47
48
49
50
package provider
import (
"testing"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)
func TestAccManagedConfigsDataSource_basic(t *testing.T) {
testAccPreCheck(t)
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: providerConfig + `
resource "simplemdm_app" "testapp" {
app_store_id = "586447913"
}
resource "simplemdm_managed_config" "config1" {
app_id = simplemdm_app.testapp.id
key = "environment"
value = "production"
value_type = "string"
}
resource "simplemdm_managed_config" "config2" {
app_id = simplemdm_app.testapp.id
key = "debug_mode"
value = "0"
value_type = "boolean"
}
data "simplemdm_managed_configs" "all" {
app_id = simplemdm_app.testapp.id
depends_on = [
simplemdm_managed_config.config1,
simplemdm_managed_config.config2,
]
}
`,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrPair("data.simplemdm_managed_configs.all", "app_id", "simplemdm_app.testapp", "id"),
resource.TestCheckResourceAttr("data.simplemdm_managed_configs.all", "managed_configs.#", "2"),
),
},
},
})
}