@@ -59,21 +59,21 @@ func TestAccGithubOrganizationDataSource(t *testing.T) {
5959 randomID := acctest .RandStringFromCharSet (5 , acctest .CharSetAlphaNum )
6060 repoName := fmt .Sprintf ("%srepo-archived-%s" , testResourcePrefix , randomID )
6161
62- config := fmt . Sprintf ( `
62+ config := `
6363 resource "github_repository" "archived" {
6464 name = "%s"
65- archived = true
66- }
65+ archived = %t
66+ }
6767
6868 data "github_organization" "skip_archived" {
69- name = "%s"
69+ name = "%[3] s"
7070 ignore_archived_repos = true
7171 depends_on = [
7272 github_repository.archived,
7373 ]
7474 }
7575 data "github_organization" "all_repos" {
76- name = "%s"
76+ name = "%[3] s"
7777 ignore_archived_repos = false
7878 depends_on = [
7979 github_repository.archived,
@@ -86,20 +86,21 @@ func TestAccGithubOrganizationDataSource(t *testing.T) {
8686 output "should_be_true" {
8787 value = contains(data.github_organization.all_repos.repositories, github_repository.archived.full_name)
8888 }
89- ` , repoName , testAccConf .owner , testAccConf .owner )
90-
91- check := resource .ComposeTestCheckFunc (
92- resource .TestCheckOutput ("should_be_false" , "false" ),
93- resource .TestCheckOutput ("should_be_true" , "true" ),
94- )
89+ `
9590
9691 resource .Test (t , resource.TestCase {
9792 PreCheck : func () { skipUnlessHasOrgs (t ) },
9893 ProviderFactories : providerFactories ,
9994 Steps : []resource.TestStep {
10095 {
101- Config : config ,
102- Check : check ,
96+ Config : fmt .Sprintf (config , repoName , false , testAccConf .owner ), // We are removing the option to create archived repositories
97+ },
98+ {
99+ Config : fmt .Sprintf (config , repoName , true , testAccConf .owner ),
100+ Check : resource .ComposeTestCheckFunc (
101+ resource .TestCheckOutput ("should_be_false" , "false" ),
102+ resource .TestCheckOutput ("should_be_true" , "true" ),
103+ ),
103104 },
104105 },
105106 })
0 commit comments