@@ -93,24 +93,57 @@ data "github_team" "test" {
9393 t .Parallel ()
9494
9595 skipUnlessHasOrgUser1 (t )
96+ skipUnlessHasOrgUser2 (t )
9697
9798 team := mustCreateTestTeam (t , nil )
98- repo := mustCreateTestRepository (t )
9999 mustAddTeamMember (t , team , testAccConf .testOrgUser1 )
100+ childTeam := mustCreateTestTeam (t , new (team.GetID ()))
101+ mustAddTeamMember (t , childTeam , testAccConf .testOrgUser2 )
102+ repo := mustCreateTestRepository (t )
100103 mustAddRepositoryTeam (t , repo , team )
101104
102105 config := fmt .Sprintf (`
103106data "github_team" "test" {
104- slug = "%s"
105- summary_only = false
107+ slug = "%s"
108+ summary_only = false
109+ membership_type = "%%v"
106110}
107111` , team .GetSlug ())
108112
109113 resource .Test (t , resource.TestCase {
110114 ProviderFactories : providerFactories ,
111115 Steps : []resource.TestStep {
112116 {
113- Config : config ,
117+ Config : fmt .Sprintf (config , "all" ),
118+ ConfigStateChecks : []statecheck.StateCheck {
119+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("team_id" ), knownvalue .Int32Exact (int32 (team .GetID ()))),
120+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("slug" ), knownvalue .StringExact (team .GetSlug ())),
121+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("node_id" ), knownvalue .StringExact (team .GetNodeID ())),
122+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("name" ), knownvalue .StringExact (team .GetName ())),
123+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("description" ), knownvalue .StringExact (team .GetDescription ())),
124+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("type" ), knownvalue .StringExact (team .GetType ())),
125+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("privacy" ), knownvalue .StringExact (team .GetPrivacy ())),
126+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("notification_setting" ), knownvalue .StringExact (team .GetNotificationSetting ())),
127+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("permission" ), knownvalue .StringExact (team .GetPermission ())),
128+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("parent_team" ), knownvalue .Null ()),
129+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("members" ), knownvalue .ListExact ([]knownvalue.Check {
130+ knownvalue .StringExact (testAccConf .testOrgUser1 ),
131+ knownvalue .StringExact (testAccConf .testOrgUser2 ),
132+ })),
133+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("repositories" ), knownvalue .ListExact ([]knownvalue.Check {
134+ knownvalue .StringExact (repo .GetName ()),
135+ })),
136+ statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("repositories_detailed" ), knownvalue .ListExact ([]knownvalue.Check {
137+ knownvalue .MapExact (map [string ]knownvalue.Check {
138+ "repo_id" : knownvalue .Int32Exact (int32 (repo .GetID ())),
139+ "repo_name" : knownvalue .StringExact (repo .GetName ()),
140+ "role_name" : knownvalue .StringExact ("read" ),
141+ }),
142+ })),
143+ },
144+ },
145+ {
146+ Config : fmt .Sprintf (config , "immediate" ),
114147 ConfigStateChecks : []statecheck.StateCheck {
115148 statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("team_id" ), knownvalue .Int32Exact (int32 (team .GetID ()))),
116149 statecheck .ExpectKnownValue ("data.github_team.test" , tfjsonpath .New ("slug" ), knownvalue .StringExact (team .GetSlug ())),
0 commit comments