// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package provider

import (
	"fmt"
	"testing"

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

func TestAcc{{resource_name}}Resource(t *testing.T) {
	rName := acctest.RandomWithPrefix("tftest")

	resource.Test(t, resource.TestCase{
		PreCheck:                 func() { testAccPreCheck(t) },
		ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
		Steps: []resource.TestStep{
			// Create and Read testing
			{
				Config: testAcc{{resource_name}}ResourceConfig(rName),
				Check: resource.ComposeAggregateTestCheckFunc(
					{% for var in r_vars -%}
					resource.TestCheckResourceAttr("{{client_name}}_{{resource_name}}.test", "{{var}}", "UPDATE ME!"),
					{% endfor %}
				),
			},
			// ImportState testing
			{
				ResourceName:      "{{client_name}}_{{resource_name}}.test",
				ImportState:       true,
				ImportStateVerify: true,
			},
			// Delete testing automatically occurs in TestCase
		},
	})
}

func testAcc{{resource_name}}ResourceConfig(name string) string {
	return fmt.Sprintf(`
provider "{{client_name}}" {
}

resource "{{client_name}}_{{resource_name}}" "test" {
  "UPDATE ME!"

}`)
}