@@ -6,9 +6,32 @@ import (
66
77 "github.com/hashicorp/terraform-plugin-testing/helper/acctest"
88 "github.com/hashicorp/terraform-plugin-testing/helper/resource"
9+ "github.com/hashicorp/terraform-plugin-testing/knownvalue"
10+ "github.com/hashicorp/terraform-plugin-testing/statecheck"
11+ "github.com/hashicorp/terraform-plugin-testing/tfjsonpath"
912)
1013
1114func TestAccGithubOrganizationDataSource (t * testing.T ) {
15+ t .Run ("uses provider owner when name is not set" , func (t * testing.T ) {
16+ config := `data "github_organization" "test" {}`
17+
18+ resource .Test (t , resource.TestCase {
19+ PreCheck : func () { skipUnlessHasOrgs (t ) },
20+ ProviderFactories : providerFactories ,
21+ Steps : []resource.TestStep {
22+ {
23+ Config : config ,
24+ ConfigStateChecks : []statecheck.StateCheck {
25+ statecheck .ExpectKnownValue ("data.github_organization.test" , tfjsonpath .New ("login" ), knownvalue .StringExact (testAccConf .owner )),
26+ statecheck .ExpectKnownValue ("data.github_organization.test" , tfjsonpath .New ("orgname" ), knownvalue .StringExact (testAccConf .owner )),
27+ statecheck .ExpectKnownValue ("data.github_organization.test" , tfjsonpath .New ("node_id" ), knownvalue .NotNull ()),
28+ statecheck .ExpectKnownValue ("data.github_organization.test" , tfjsonpath .New ("plan" ), knownvalue .NotNull ()),
29+ },
30+ },
31+ },
32+ })
33+ })
34+
1235 t .Run ("queries for an organization without error" , func (t * testing.T ) {
1336 config := fmt .Sprintf (`
1437 data "github_organization" "test" {
0 commit comments