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_security_manager_test.go
More file actions
47 lines (40 loc) · 1.34 KB
/
data_source_github_organization_security_manager_test.go
File metadata and controls
47 lines (40 loc) · 1.34 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
package github
import (
"fmt"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)
func TestAccDataSourceGithubOrganizationSecurityManagers(t *testing.T) {
t.Run("get the organization security managers without error", func(t *testing.T) {
randomID := acctest.RandStringFromCharSet(5, acctest.CharSetAlphaNum)
teamName := fmt.Sprintf("tf-acc-%s", randomID)
config := fmt.Sprintf(`
resource "github_team" "test" {
name = "%s"
}
resource "github_organization_security_manager" "test" {
team_slug = github_team.test.slug
}
data "github_organization_security_managers" "test" {
depends_on = [
github_organization_security_manager.test
]
}
`, teamName)
resource.Test(t, resource.TestCase{
PreCheck: func() { skipUnlessMode(t, organization) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("data.github_organization_security_managers.test", "teams.#"),
resource.TestCheckResourceAttr("data.github_organization_security_managers.test", "teams.#", "1"),
resource.TestCheckResourceAttr("data.github_organization_security_managers.test", "teams.0.name", teamName),
),
},
},
})
})
}