Skip to content

Commit

Permalink
Condense acc tests into one test
Browse files Browse the repository at this point in the history
  • Loading branch information
devin-brenton committed Nov 22, 2024
1 parent b9f6718 commit e7ba0d1
Show file tree
Hide file tree
Showing 6 changed files with 1,036 additions and 1,210 deletions.
53 changes: 16 additions & 37 deletions internal/auth0/client/data_source_clients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,24 @@ data "auth0_clients" "test" {
}
`

func TestAccDataClientsNameFilter(t *testing.T) {
const testAccDataClientsWithInvalidAppTypeFilter = `
data "auth0_clients" "test" {
app_types = ["invalid"]
}
`

func TestAccDataClients(t *testing.T) {
acctest.Test(t, resource.TestCase{
PreventPostDestroyRefresh: true,
Steps: []resource.TestStep{
{
Config: acctest.ParseTestName(testAccDataClientsWithInvalidAppTypeFilter, t.Name()),
ExpectError: regexp.MustCompile(
`expected app_types\.0 to be one of \["native" "spa" "regular_web" "non_interactive" "rms" "box" "cloudbees" "concur" "dropbox" "mscrm" "echosign" "egnyte" "newrelic" "office365" "salesforce" "sentry" "sharepoint" "slack" "springcm" "sso_integration" "zendesk" "zoom"\], got invalid`,
),
},
{
Config: acctest.ParseTestName(testAccGivenSomeClients, t.Name()),
},
{
Config: acctest.ParseTestName(testAccGivenSomeClients+testAccDataClientsWithNameFilter, t.Name()),
Check: resource.ComposeTestCheckFunc(
Expand All @@ -78,14 +92,6 @@ func TestAccDataClientsNameFilter(t *testing.T) {
resource.TestCheckResourceAttrSet("data.auth0_clients.test", "clients.1.is_first_party"),
),
},
},
})
}

func TestAccDataClientsAppTypeFilter(t *testing.T) {
acctest.Test(t, resource.TestCase{
PreventPostDestroyRefresh: true,
Steps: []resource.TestStep{
{
Config: acctest.ParseTestName(testAccGivenSomeClients+testAccDataClientsWithAppTypeFilter, t.Name()),
Check: resource.ComposeTestCheckFunc(
Expand All @@ -95,14 +101,6 @@ func TestAccDataClientsAppTypeFilter(t *testing.T) {
resource.TestCheckResourceAttr("data.auth0_clients.test", "clients.0.name", fmt.Sprintf("Acceptance Test 1 - %v", t.Name())),
),
},
},
})
}

func TestAccDataClientsIsFirstPartyFilter(t *testing.T) {
acctest.Test(t, resource.TestCase{
PreventPostDestroyRefresh: true,
Steps: []resource.TestStep{
{
Config: acctest.ParseTestName(testAccGivenSomeClients+testAccDataClientsWithIsFirstPartyFilter, t.Name()),
Check: resource.ComposeTestCheckFunc(
Expand All @@ -115,22 +113,3 @@ func TestAccDataClientsIsFirstPartyFilter(t *testing.T) {
},
})
}

const testAccDataClientsWithInvalidAppTypeFilter = `
data "auth0_clients" "test" {
app_types = ["invalid"]
}
`

func TestAccDataClientsInvalidAppTypeFilter(t *testing.T) {
acctest.Test(t, resource.TestCase{
Steps: []resource.TestStep{
{
Config: acctest.ParseTestName(testAccDataClientsWithInvalidAppTypeFilter, t.Name()),
ExpectError: regexp.MustCompile(
`expected app_types\.0 to be one of \["native" "spa" "regular_web" "non_interactive" "rms" "box" "cloudbees" "concur" "dropbox" "mscrm" "echosign" "egnyte" "newrelic" "office365" "salesforce" "sentry" "sharepoint" "slack" "springcm" "sso_integration" "zendesk" "zoom"\], got invalid`,
),
},
},
})
}
Loading

0 comments on commit e7ba0d1

Please sign in to comment.