Implemented integration test for data source azuredevops_team
// +build !exclude_data_sources !exclude_data_team
package acceptancetests
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/hashicorp/terraform-plugin-sdk/helper/resource"
+ "github.com/terraform-providers/terraform-provider-azuredevops/azuredevops/internal/acceptancetests/testutils"
+)
+
+func TestAccTeam_DataSource(t *testing.T) {
+ projectName := testutils.GenerateResourceName()
+ projectResource := testutils.HclProjectResource(projectName)
+
+ config := fmt.Sprintf(`
+
+%s
+
+data "azuredevops_team" "team" {
+ project_id = azuredevops_project.project.id
+ name = "${azuredevops_project.project.project_name} Team"
+}
+
+ `, projectResource)
+
+ tfNode := "data.azuredevops_team.team"
+ resource.Test(t, resource.TestCase{
+ PreCheck: func() { testutils.PreCheck(t, nil) },
+ Providers: testutils.GetProviders(),
+ PreventPostDestroyRefresh: true,
+ Steps: []resource.TestStep{
+ {
+ Config: config,
+ Check: resource.ComposeTestCheckFunc(
+ resource.TestCheckResourceAttrSet(tfNode, "name"),
+ resource.TestCheckResourceAttrSet(tfNode, "description"),
+ resource.TestCheckResourceAttrSet(tfNode, "administrators.#"),
+ resource.TestCheckResourceAttrSet(tfNode, "members.#"),
+ ),
+ },
+ },
+ })
+}
