Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
TomerHeber committed Sep 15, 2024
1 parent 5c3d871 commit b1d22bb
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions env0/resource_environment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2961,6 +2961,39 @@ func TestUnitEnvironmentWithSubEnvironment(t *testing.T) {
},
}

t.Run("Fail when approve plan automatically is false", func(t *testing.T) {
testCase := resource.TestCase{
Steps: []resource.TestStep{
{
Config: fmt.Sprintf(`
resource "%s" "%s" {
name = "%s"
project_id = "%s"
template_id = "%s"
force_destroy = true
approve_plan_automatically = false
sub_environment_configuration {
alias = "%s"
revision = "%s"
workspace = "%s"
}
}`,
resourceType, resourceName,
environmentCreatePayload.Name,
environmentCreatePayload.ProjectId,
environment.BlueprintId,
subEnvironment.Alias,
subEnvironment.Revision,
subEnvironment.Workspace,
),
ExpectError: regexp.MustCompile("approve_plan_automatically cannot be 'false' for workflows"),
},
},
}

runUnitTest(t, testCase, func(mock *client.MockApiClientInterface) {})
})

t.Run("Success in create", func(t *testing.T) {
testCase := resource.TestCase{
Steps: []resource.TestStep{
Expand Down

0 comments on commit b1d22bb

Please sign in to comment.