Skip to content

Commit ff7bf30

Browse files
committed
Fix v4client tests
Signed-off-by: Timo Sand <[email protected]>
1 parent a9f36fe commit ff7bf30

3 files changed

Lines changed: 18 additions & 15 deletions

File tree

github/data_source_github_organization_test.go

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -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
})

github/data_source_github_team_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ func TestAccGithubTeamDataSource(t *testing.T) {
170170
171171
resource "github_team" "test" {
172172
name = "%s"
173+
description = "Test team"
173174
}
174175
175176
resource "github_team_repository" "test" {

github/data_source_github_user_external_identity_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package github
22

33
import (
4+
"fmt"
45
"testing"
56

67
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
78
)
89

910
func TestAccGithubUserExternalIdentity(t *testing.T) {
1011
t.Run("queries without error", func(t *testing.T) {
11-
config := `data "github_user_external_identity" "test" {}`
12+
config := `data "github_user_external_identity" "test" { username = "%s" }`
1213

1314
check := resource.ComposeAggregateTestCheckFunc(
1415
resource.TestCheckResourceAttrSet("data.github_user_external_identity.test", "login"),
@@ -21,7 +22,7 @@ func TestAccGithubUserExternalIdentity(t *testing.T) {
2122
ProviderFactories: providerFactories,
2223
Steps: []resource.TestStep{
2324
{
24-
Config: config,
25+
Config: fmt.Sprintf(config, testAccConf.testExternalUser),
2526
Check: check,
2627
},
2728
},

0 commit comments

Comments
 (0)