removed omitempty from the forkable boolean value

This commit is contained in:
Jason Reeves
2020-10-28 15:52:44 -05:00
parent 06db60ee0e
commit ae1adf0be1
2 changed files with 24 additions and 1 deletions

View File

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

View File

@@ -24,10 +24,19 @@ func TestAccBitbucketRepository_basic(t *testing.T) {
project = bitbucketserver_project.test.key project = bitbucketserver_project.test.key
name = "test-repo-for-repository-test" name = "test-repo-for-repository-test"
description = "My Repo" 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()) `, rand.New(rand.NewSource(time.Now().UnixNano())).Int())
configModified := strings.ReplaceAll(config, "My Repo", "My Updated Repo") configModified := strings.ReplaceAll(config, "My Repo", "My Updated Repo")
configModifiedBool := strings.ReplaceAll(config, "false", "true")
resource.Test(t, resource.TestCase{ resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) }, 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", "slug", "test-repo-for-repository-test"),
resource.TestCheckResourceAttr("bitbucketserver_repository.test_repo", "name", "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", "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"), 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"),
),
},
}, },
}) })
} }