-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test for data-source windows_local_group
- Loading branch information
Showing
1 changed file
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package local_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/d-strobel/terraform-provider-windows/internal/acctest" | ||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
) | ||
|
||
func TestAccLocalGroupDataSource(t *testing.T) { | ||
resource.Test(t, resource.TestCase{ | ||
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, | ||
Steps: []resource.TestStep{ | ||
// Check if the data source works with name | ||
{ | ||
Config: acctest.ProviderConfig() + ` | ||
data "windows_local_group" "test" { | ||
name = "Administrators" | ||
} | ||
`, | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
resource.TestCheckResourceAttr("data.windows_local_group.test", "id", "S-1-5-32-544"), | ||
resource.TestCheckResourceAttr("data.windows_local_group.test", "sid", "S-1-5-32-544"), | ||
resource.TestCheckResourceAttr("data.windows_local_group.test", "name", "Administrators"), | ||
resource.TestCheckResourceAttr("data.windows_local_group.test", "description", "Administrators have complete and unrestricted access to the computer/domain"), | ||
), | ||
}, | ||
// Check if the data source works with SID | ||
{ | ||
Config: acctest.ProviderConfig() + ` | ||
data "windows_local_group" "test" { | ||
sid = "S-1-5-32-544" | ||
} | ||
`, | ||
Check: resource.ComposeAggregateTestCheckFunc( | ||
resource.TestCheckResourceAttr("data.windows_local_group.test", "id", "S-1-5-32-544"), | ||
resource.TestCheckResourceAttr("data.windows_local_group.test", "sid", "S-1-5-32-544"), | ||
resource.TestCheckResourceAttr("data.windows_local_group.test", "name", "Administrators"), | ||
resource.TestCheckResourceAttr("data.windows_local_group.test", "description", "Administrators have complete and unrestricted access to the computer/domain"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
// const testAccLocalGroupDataSourceConfig = ` | ||
// data "windows_local_group" "test" { | ||
// name = "Administrators" | ||
// } | ||
// ` |