Files
terraform-provider-bitbucke…/bitbucket/data_user_test.go
2024-02-05 00:19:08 +01:00

33 lines
991 B
Go

package bitbucket
import (
"testing"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)
func TestAccBitbucketDataUser(t *testing.T) {
config := `
data "bitbucketserver_user" "test" {
name = "admin"
}
`
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProtoV6ProviderFactories: ProviderFactories,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.bitbucketserver_user.test", "name", "admin"),
resource.TestCheckResourceAttr("data.bitbucketserver_user.test", "email_address", "admin@example.com"),
resource.TestCheckResourceAttr("data.bitbucketserver_user.test", "display_name", "Admin"),
// not sure, why admin has user_id 2 by default, but it seems to be the case since the bitbucket server update
resource.TestCheckResourceAttr("data.bitbucketserver_user.test", "user_id", "2"),
),
},
},
})
}