forked from integrations/terraform-provider-github
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata_source_github_organization_role_test.go
More file actions
38 lines (34 loc) · 1.21 KB
/
data_source_github_organization_role_test.go
File metadata and controls
38 lines (34 loc) · 1.21 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
package github
import (
"fmt"
"strconv"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)
func TestAccDataSourceGithubOrganizationRole(t *testing.T) {
t.Run("get the organization role without error", func(t *testing.T) {
roleId := 138
config := fmt.Sprintf(`
data "github_organization_role" "test" {
role_id = %d
}
`, roleId)
resource.Test(t, resource.TestCase{
PreCheck: func() { skipUnlessHasOrgs(t) },
ProviderFactories: providerFactories,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.github_organization_role.test", "role_id", strconv.Itoa(roleId)),
resource.TestCheckResourceAttr("data.github_organization_role.test", "name", "security_manager"),
resource.TestCheckResourceAttr("data.github_organization_role.test", "source", "Predefined"),
resource.TestCheckResourceAttr("data.github_organization_role.test", "base_role", "read"),
resource.TestCheckResourceAttrSet("data.github_organization_role.test", "description"),
resource.TestCheckResourceAttrSet("data.github_organization_role.test", "permissions.#"),
),
},
},
})
})
}