From 19b03c8cd6fcf4047e55981c9b62f461007083b2 Mon Sep 17 00:00:00 2001 From: Kevin Gibson Date: Mon, 18 Mar 2024 17:57:26 -0700 Subject: [PATCH] + Group Lookup test --- .../groups_lookup_data_source_test.go | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 internal/provider/groups_lookup_data_source_test.go diff --git a/internal/provider/groups_lookup_data_source_test.go b/internal/provider/groups_lookup_data_source_test.go new file mode 100644 index 0000000..e24824d --- /dev/null +++ b/internal/provider/groups_lookup_data_source_test.go @@ -0,0 +1,29 @@ +package provider + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceGroupLookup(t *testing.T) { + resource.Test(t, resource.TestCase{ + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + // Create a new user group and verify that aspects of it are correct + Config: providerConfig + `data "jumpcloud_group_lookup" "g" { + name = "a" + }`, + // Compose multiple test checks to verify the resource + Check: resource.ComposeTestCheckFunc( + resource.TestMatchResourceAttr( + "data.jumpcloud_group_lookup.g", + "groups.#", + regexp.MustCompile(`^0*[1-9]\d*$`)), // regex for a positive integer + ), + }, + }, + }) +}