Merge pull request #22 from jare19/bugfix/forkable

removed omitempty from the forkable boolean value
This commit is contained in:
Gavin Bunney
2020-11-06 12:33:04 -08:00
committed by GitHub
2 changed files with 24 additions and 1 deletions

View File

@@ -19,7 +19,7 @@ type Repository struct {
Name string `json:"name,omitempty"`
Slug string `json:"slug,omitempty"`
Description string `json:"description,omitempty"`
Forkable bool `json:"forkable,omitempty"`
Forkable bool `json:"forkable"`
Public bool `json:"public,omitempty"`
Links struct {
Clone []CloneUrl `json:"clone,omitempty"`

View File

@@ -24,10 +24,19 @@ func TestAccBitbucketRepository_basic(t *testing.T) {
project = bitbucketserver_project.test.key
name = "test-repo-for-repository-test"
description = "My Repo"
forkable = false
public = false
}
resource "bitbucketserver_repository" "test_repo_defaults" {
project = bitbucketserver_project.test.key
name = "test-repo-for-repository-test_defaults"
description = "My_Repo2"
}
`, rand.New(rand.NewSource(time.Now().UnixNano())).Int())
configModified := strings.ReplaceAll(config, "My Repo", "My Updated Repo")
configModifiedBool := strings.ReplaceAll(config, "false", "true")
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
@@ -41,6 +50,10 @@ func TestAccBitbucketRepository_basic(t *testing.T) {
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo", "slug", "test-repo-for-repository-test"),
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo", "name", "test-repo-for-repository-test"),
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo", "description", "My Repo"),
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo", "forkable", "false"),
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo", "public", "false"),
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo_defaults", "forkable", "true"),
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo_defaults", "public", "false"),
),
},
{
@@ -52,6 +65,16 @@ func TestAccBitbucketRepository_basic(t *testing.T) {
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo", "description", "My Updated Repo"),
),
},
{
Config: configModifiedBool,
Check: resource.ComposeTestCheckFunc(
testAccCheckBitbucketRepositoryExists("bitbucketserver_repository.test_repo", &repo),
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo", "slug", "test-repo-for-repository-test"),
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo", "name", "test-repo-for-repository-test"),
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo", "forkable", "true"),
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo", "public", "true"),
),
},
},
})
}