-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tujit Bora
committed
Oct 4, 2024
1 parent
0636ec2
commit d514d4c
Showing
12 changed files
with
431 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package datasources_test | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"testing" | ||
|
||
acctest "github.com/Cidaas/terraform-provider-cidaas/internal/test" | ||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
) | ||
|
||
func TestAccDataSourceConsent_basic(t *testing.T) { | ||
t.Parallel() | ||
resourceName := "data.cidaas_consent.sample" | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { acctest.TestAccPreCheck(t) }, | ||
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: fmt.Sprintf(` | ||
provider "cidaas" { | ||
base_url = "%s" | ||
} | ||
data "cidaas_consent" "sample" { | ||
} | ||
`, os.Getenv("BASE_URL")), // replace with acctest.BaseURL or have a init func to set the base URL | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet(resourceName, "consent.#"), | ||
resource.TestCheckResourceAttrSet(resourceName, "consent.0.id"), | ||
resource.TestCheckResourceAttrSet(resourceName, "consent.0.consent_name"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package datasources_test | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"testing" | ||
|
||
acctest "github.com/Cidaas/terraform-provider-cidaas/internal/test" | ||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
) | ||
|
||
func TestAccDataSourceCustomProvider_basic(t *testing.T) { | ||
t.Parallel() | ||
resourceName := "data.cidaas_custom_provider.sample" | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { acctest.TestAccPreCheck(t) }, | ||
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: fmt.Sprintf(` | ||
provider "cidaas" { | ||
base_url = "%s" | ||
} | ||
data "cidaas_custom_provider" "sample" { | ||
} | ||
`, os.Getenv("BASE_URL")), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet(resourceName, "custom_provider.#"), | ||
resource.TestCheckResourceAttrSet(resourceName, "custom_provider.0.provider_name"), | ||
resource.TestCheckResourceAttrSet(resourceName, "custom_provider.0.standard_type"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package datasources_test | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"testing" | ||
|
||
acctest "github.com/Cidaas/terraform-provider-cidaas/internal/test" | ||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
) | ||
|
||
func TestAccRegFieldDataSource_Basic(t *testing.T) { | ||
t.Parallel() | ||
resourceName := "data.cidaas_registration_field.sample" | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { acctest.TestAccPreCheck(t) }, | ||
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: fmt.Sprintf(` | ||
provider "cidaas" { | ||
base_url = "%s" | ||
} | ||
data "cidaas_registration_field" "sample" { | ||
} | ||
`, os.Getenv("BASE_URL")), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.#"), | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.0.id"), | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.0.parent_group_id"), | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.0.field_type"), | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.0.data_type"), | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.0.field_key"), | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.0.required"), | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.0.internal"), | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.0.enabled"), | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.0.read_only"), | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.0.is_group"), | ||
resource.TestCheckResourceAttrSet(resourceName, "registration_field.0.order"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccRegFieldDataSource_FieldTypeFilter(t *testing.T) { | ||
t.Parallel() | ||
resourceName := "data.cidaas_registration_field.sample" | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { acctest.TestAccPreCheck(t) }, | ||
ProtoV6ProviderFactories: acctest.TestAccProtoV6ProviderFactories, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: fmt.Sprintf(` | ||
provider "cidaas" { | ||
base_url = "%s" | ||
} | ||
data "cidaas_registration_field" "sample" { | ||
filter { | ||
name = "field_type" | ||
values = ["CUSTOM"] | ||
} | ||
} | ||
`, os.Getenv("BASE_URL")), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttr(resourceName, "registration_field.0.field_type", "CUSTOM"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} |
Oops, something went wrong.