Added bitbucketserver_project_permissions_user resource and bitbucketserver_project_permissions_users data source

This commit is contained in:
Gavin Bunney
2019-10-10 08:34:39 -07:00
parent acf8c904e0
commit d63df2e655
6 changed files with 431 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
package bitbucket
import (
"fmt"
"math/rand"
"testing"
"time"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccBitbucketResourceProjectPermissionsUser(t *testing.T) {
projectKey := fmt.Sprintf("TEST%v", rand.New(rand.NewSource(time.Now().UnixNano())).Int())
config := fmt.Sprintf(`
resource "bitbucketserver_project" "test" {
key = "%v"
name = "test-repo-for-repository-test"
}
resource "bitbucketserver_project_permissions_user" "test" {
project = bitbucketserver_project.test.key
user = "admin2"
permission = "PROJECT_READ"
}
`, projectKey)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: config,
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("bitbucketserver_project_permissions_user.test", "id", projectKey+"/admin2"),
resource.TestCheckResourceAttr("bitbucketserver_project_permissions_user.test", "project", projectKey),
resource.TestCheckResourceAttr("bitbucketserver_project_permissions_user.test", "user", "admin2"),
resource.TestCheckResourceAttr("bitbucketserver_project_permissions_user.test", "permission", "PROJECT_READ"),
),
},
},
})
}