-
Notifications
You must be signed in to change notification settings - Fork 953
Expand file tree
/
Copy pathdata_source_github_enterprise_custom_properties_test.go
More file actions
58 lines (51 loc) · 2.06 KB
/
data_source_github_enterprise_custom_properties_test.go
File metadata and controls
58 lines (51 loc) · 2.06 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
51
52
53
54
55
56
57
58
package github
import (
"fmt"
"testing"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
)
func TestAccGithubEnterpriseCustomPropertiesDataSource(t *testing.T) {
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlpha)
propertyName := fmt.Sprintf("test-%s", randomID)
config := fmt.Sprintf(`
resource "github_enterprise_custom_properties" "test" {
enterprise_slug = "%s"
property_name = "%s"
value_type = "string"
required = true
default_value = "terraform"
description = "A test property"
values_editable_by = "org_and_repo_actors"
}
data "github_enterprise_custom_properties" "test" {
enterprise_slug = "%s"
property_name = github_enterprise_custom_properties.test.property_name
}
`,
testAccConf.enterpriseSlug,
propertyName,
testAccConf.enterpriseSlug,
)
check := resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.github_enterprise_custom_properties.test", "enterprise_slug", testAccConf.enterpriseSlug),
resource.TestCheckResourceAttr("data.github_enterprise_custom_properties.test", "property_name", propertyName),
resource.TestCheckResourceAttr("data.github_enterprise_custom_properties.test", "allowed_values.#", "0"),
resource.TestCheckResourceAttr("data.github_enterprise_custom_properties.test", "value_type", "string"),
resource.TestCheckResourceAttr("data.github_enterprise_custom_properties.test", "required", "true"),
resource.TestCheckResourceAttr("data.github_enterprise_custom_properties.test", "default_value", "terraform"),
resource.TestCheckResourceAttr("data.github_enterprise_custom_properties.test", "description", "A test property"),
resource.TestCheckResourceAttr("data.github_enterprise_custom_properties.test", "values_editable_by", "org_and_repo_actors"),
)
resource.Test(t, resource.TestCase{
PreCheck: func() { skipUnlessEnterprise(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: config,
Check: check,
},
},
},
)
}