@@ -432,20 +432,15 @@ func TestAccGithubRepository(t *testing.T) {
432432 }
433433 ` , testRepoName , testAccConf .testPublicTemplateRepositoryOwner , testAccConf .testPublicTemplateRepository )
434434
435- check := resource .ComposeTestCheckFunc (
436- resource .TestCheckResourceAttr (
437- "github_repository.test" , "is_template" ,
438- "false" ,
439- ),
440- )
441-
442435 resource .Test (t , resource.TestCase {
443436 PreCheck : func () { skipUnauthenticated (t ) },
444437 ProviderFactories : providerFactories ,
445438 Steps : []resource.TestStep {
446439 {
447440 Config : config ,
448- Check : check ,
441+ Check : resource .ComposeTestCheckFunc (
442+ resource .TestCheckResourceAttr ("github_repository.test" , "is_template" , "false" ),
443+ ),
449444 },
450445 },
451446 })
@@ -467,20 +462,15 @@ func TestAccGithubRepository(t *testing.T) {
467462 }
468463 ` , testRepoName , testAccConf .owner , testAccConf .testOrgTemplateRepository )
469464
470- check := resource .ComposeTestCheckFunc (
471- resource .TestCheckResourceAttr (
472- "github_repository.test" , "is_template" ,
473- "false" ,
474- ),
475- )
476-
477465 resource .Test (t , resource.TestCase {
478466 PreCheck : func () { skipUnlessHasOrgs (t ) },
479467 ProviderFactories : providerFactories ,
480468 Steps : []resource.TestStep {
481469 {
482470 Config : config ,
483- Check : check ,
471+ Check : resource .ComposeTestCheckFunc (
472+ resource .TestCheckResourceAttr ("github_repository.test" , "is_template" , "false" ),
473+ ),
484474 },
485475 },
486476 })
@@ -498,34 +488,23 @@ func TestAccGithubRepository(t *testing.T) {
498488 }
499489 ` , testRepoName )
500490
501- checks := map [string ]resource.TestCheckFunc {
502- "before" : resource .ComposeTestCheckFunc (
503- resource .TestCheckResourceAttr (
504- "github_repository.test" , "archived" ,
505- "false" ,
506- ),
507- ),
508- "after" : resource .ComposeTestCheckFunc (
509- resource .TestCheckResourceAttr (
510- "github_repository.test" , "archived" ,
511- "true" ,
512- ),
513- ),
514- }
515-
516491 resource .Test (t , resource.TestCase {
517492 PreCheck : func () { skipUnauthenticated (t ) },
518493 ProviderFactories : providerFactories ,
519494 Steps : []resource.TestStep {
520495 {
521496 Config : config ,
522- Check : checks ["before" ],
497+ Check : resource .ComposeTestCheckFunc (
498+ resource .TestCheckResourceAttr ("github_repository.test" , "archived" , "false" ),
499+ ),
523500 },
524501 {
525502 Config : strings .Replace (config ,
526503 `archived = false` ,
527504 `archived = true` , 1 ),
528- Check : checks ["after" ],
505+ Check : resource .ComposeTestCheckFunc (
506+ resource .TestCheckResourceAttr ("github_repository.test" , "archived" , "true" ),
507+ ),
529508 },
530509 },
531510 })
@@ -856,40 +835,23 @@ resource "github_repository" "test" {
856835 ` , testRepoName , updatedMergeCommitTitle , updatedMergeCommitMessage ),
857836 }
858837
859- checks := map [string ]resource.TestCheckFunc {
860- "before" : resource .ComposeTestCheckFunc (
861- resource .TestCheckResourceAttr (
862- "github_repository.test" , "merge_commit_title" ,
863- mergeCommitTitle ,
864- ),
865- resource .TestCheckResourceAttr (
866- "github_repository.test" , "merge_commit_message" ,
867- mergeCommitMessage ,
868- ),
869- ),
870- "after" : resource .ComposeTestCheckFunc (
871- resource .TestCheckResourceAttr (
872- "github_repository.test" , "merge_commit_title" ,
873- updatedMergeCommitTitle ,
874- ),
875- resource .TestCheckResourceAttr (
876- "github_repository.test" , "merge_commit_message" ,
877- updatedMergeCommitMessage ,
878- ),
879- ),
880- }
881-
882838 resource .Test (t , resource.TestCase {
883839 PreCheck : func () { skipUnauthenticated (t ) },
884840 ProviderFactories : providerFactories ,
885841 Steps : []resource.TestStep {
886842 {
887843 Config : configs ["before" ],
888- Check : checks ["before" ],
844+ Check : resource .ComposeTestCheckFunc (
845+ resource .TestCheckResourceAttr ("github_repository.test" , "merge_commit_title" , mergeCommitTitle ),
846+ resource .TestCheckResourceAttr ("github_repository.test" , "merge_commit_message" , mergeCommitMessage ),
847+ ),
889848 },
890849 {
891850 Config : configs ["after" ],
892- Check : checks ["after" ],
851+ Check : resource .ComposeTestCheckFunc (
852+ resource .TestCheckResourceAttr ("github_repository.test" , "merge_commit_title" , updatedMergeCommitTitle ),
853+ resource .TestCheckResourceAttr ("github_repository.test" , "merge_commit_message" , updatedMergeCommitMessage ),
854+ ),
893855 },
894856 },
895857 })
@@ -925,24 +887,12 @@ resource "github_repository" "test" {
925887
926888 checks := map [string ]resource.TestCheckFunc {
927889 "before" : resource .ComposeTestCheckFunc (
928- resource .TestCheckResourceAttr (
929- "github_repository.test" , "squash_merge_commit_title" ,
930- squashMergeCommitTitle ,
931- ),
932- resource .TestCheckResourceAttr (
933- "github_repository.test" , "squash_merge_commit_message" ,
934- squashMergeCommitMessage ,
935- ),
890+ resource .TestCheckResourceAttr ("github_repository.test" , "squash_merge_commit_title" , squashMergeCommitTitle ),
891+ resource .TestCheckResourceAttr ("github_repository.test" , "squash_merge_commit_message" , squashMergeCommitMessage ),
936892 ),
937893 "after" : resource .ComposeTestCheckFunc (
938- resource .TestCheckResourceAttr (
939- "github_repository.test" , "squash_merge_commit_title" ,
940- updatedSquashMergeCommitTitle ,
941- ),
942- resource .TestCheckResourceAttr (
943- "github_repository.test" , "squash_merge_commit_message" ,
944- updatedSquashMergeCommitMessage ,
945- ),
894+ resource .TestCheckResourceAttr ("github_repository.test" , "squash_merge_commit_title" , updatedSquashMergeCommitTitle ),
895+ resource .TestCheckResourceAttr ("github_repository.test" , "squash_merge_commit_message" , updatedSquashMergeCommitMessage ),
946896 ),
947897 }
948898
0 commit comments