Skip to content

Commit

Permalink
test(provider/preview_api_key): test reading a nonexistent api key
Browse files Browse the repository at this point in the history
  • Loading branch information
cysp committed Nov 10, 2024
1 parent 8910673 commit 7d2dc22
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions internal/provider/preview_api_key_data_source_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package provider_test

import (
"regexp"
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)

func TestAccPreviewApiKeyResourceImportNotFound(t *testing.T) {
t.Parallel()

resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
{
Config: `
data "contentful_preview_api_key" "test" {
space_id = "0p38pssr0fi3"
preview_api_key_id = "unknown"
}
`,
ExpectError: regexp.MustCompile(`Failed to read preview api key`),
},
},
})
}

0 comments on commit 7d2dc22

Please sign in to comment.