@@ -1158,48 +1158,31 @@ resource "github_repository" "test" {
11581158 })
11591159 })
11601160
1161- t .Run ("updates repos to public visibility " , func (t * testing.T ) {
1161+ t .Run ("updates_repos_to_public_visibility " , func (t * testing.T ) {
11621162 randomID := acctest .RandStringFromCharSet (5 , acctest .CharSetAlphaNum )
11631163 testRepoName := fmt .Sprintf ("%spublic-vuln-%s" , testResourcePrefix , randomID )
1164- config := fmt . Sprintf ( `
1164+ config := `
11651165 resource "github_repository" "test" {
11661166 name = "%s"
1167- visibility = "private "
1167+ visibility = "%s "
11681168 }
1169- ` , testRepoName )
1170-
1171- checks := map [string ]resource.TestCheckFunc {
1172- "before" : resource .ComposeTestCheckFunc (
1173- resource .TestCheckResourceAttr (
1174- "github_repository.test" , "vulnerability_alerts" ,
1175- "false" ,
1176- ),
1177- ),
1178- "after" : resource .ComposeTestCheckFunc (
1179- resource .TestCheckResourceAttr (
1180- "github_repository.test" , "vulnerability_alerts" ,
1181- "true" ,
1182- ),
1183- resource .TestCheckResourceAttr (
1184- "github_repository.test" , "visibility" ,
1185- "private" ,
1186- ),
1187- ),
1188- }
1169+ `
11891170
11901171 resource .Test (t , resource.TestCase {
11911172 PreCheck : func () { skipUnauthenticated (t ) },
11921173 ProviderFactories : providerFactories ,
11931174 Steps : []resource.TestStep {
11941175 {
1195- Config : config ,
1196- Check : checks ["before" ],
1176+ Config : fmt .Sprintf (config , testRepoName , "private" ),
1177+ Check : resource .ComposeTestCheckFunc (
1178+ resource .TestCheckResourceAttr ("github_repository.test" , "visibility" , "private" ),
1179+ ),
11971180 },
11981181 {
1199- Config : strings . Replace (config ,
1200- `}` ,
1201- "vulnerability_alerts = true \n }" , 1 ),
1202- Check : checks [ "after" ] ,
1182+ Config : fmt . Sprintf (config , testRepoName , "public" ) ,
1183+ Check : resource . ComposeTestCheckFunc (
1184+ resource . TestCheckResourceAttr ( "github_repository.test" , "visibility" , "public" ),
1185+ ) ,
12031186 },
12041187 },
12051188 })
0 commit comments