* add DNS record * revamp tests * lint * cleanup * feat dns test * chore: add DNS Record tests * linting * f
53 lines
1.1 KiB
Go
53 lines
1.1 KiB
Go
package acctest
|
|
|
|
import (
|
|
"fmt"
|
|
pt "github.com/filipowm/terraform-provider-unifi/internal/provider/testing"
|
|
"github.com/hashicorp/terraform-plugin-testing/helper/acctest"
|
|
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
|
|
"testing"
|
|
)
|
|
|
|
func TestAccDataAccount_default(t *testing.T) {
|
|
name := acctest.RandomWithPrefix("tfacc")
|
|
AcceptanceTest(t, AcceptanceTestCase{
|
|
// TODO: CheckDestroy: ,
|
|
Steps: []resource.TestStep{
|
|
{
|
|
Config: testAccDataAccountConfig(name, "secure_1234"),
|
|
Check: resource.ComposeTestCheckFunc(),
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
func TestAccDataAccount_mac(t *testing.T) {
|
|
mac, unallocateMac := pt.AllocateTestMac(t)
|
|
defer unallocateMac()
|
|
|
|
AcceptanceTest(t, AcceptanceTestCase{
|
|
Steps: []resource.TestStep{
|
|
{
|
|
Config: testAccDataAccountConfig(mac, mac),
|
|
Check: resource.ComposeTestCheckFunc(),
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
func testAccDataAccountConfig(name, password string) string {
|
|
return fmt.Sprintf(`
|
|
resource "unifi_account" "test" {
|
|
name = "%[1]s"
|
|
password = "%[2]s"
|
|
}
|
|
|
|
data "unifi_account" "test" {
|
|
name = "%[1]s"
|
|
depends_on = [
|
|
unifi_account.test
|
|
]
|
|
}
|
|
`, name, password)
|
|
}
|