Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Broken Test Case #1120

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 6 additions & 37 deletions internal/auth0/client/data_source_clients_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,28 @@ import (

const testAccGivenSomeClients = `
resource "auth0_client" "my_client_1" {
name = "Acceptance Test 1 - {{.testName}}"
name = "Acceptance Test {{.testName}} - 1"
app_type = "non_interactive"
is_first_party = true
description = "Description for client 1 {{.testName}}"
}

resource "auth0_client" "my_client_2" {
name = "Acceptance Test 2 - {{.testName}}"
name = "Acceptance Test {{.testName}} - 2"
app_type = "spa"
is_first_party = false
description = "Description for client 2 {{.testName}}"
}
`

const testAccDataClientsWithNameFilter = `
data "auth0_clients" "test" {
depends_on = [
auth0_client.my_client_1,
auth0_client.my_client_2
]

name_filter = "{{.testName}}"
}
`

const testAccDataClientsWithAppTypeFilter = `
data "auth0_clients" "test" {
depends_on = [
auth0_client.my_client_1,
auth0_client.my_client_2
]

name_filter = "{{.testName}}"
name_filter = "{{.testName}}"
app_types = ["non_interactive"]
}
`
Expand All @@ -56,7 +45,7 @@ data "auth0_clients" "test" {
auth0_client.my_client_2
]

name_filter = "{{.testName}}"
name_filter = "{{.testName}}"
is_first_party = true
}
`
Expand All @@ -76,33 +65,13 @@ func TestAccDataClients(t *testing.T) {
`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(
resource.TestCheckTypeSetElemNestedAttrs("data.auth0_clients.test", "clients.*", map[string]string{
"name": fmt.Sprintf("Acceptance Test 1 - %s", t.Name()),
"app_type": "non_interactive",
"is_first_party": "true",
"description": fmt.Sprintf("Description for client 1 %s", t.Name()),
}),
resource.TestCheckTypeSetElemNestedAttrs("data.auth0_clients.test", "clients.*", map[string]string{
"name": fmt.Sprintf("Acceptance Test 2 - %s", t.Name()),
"app_type": "spa",
"is_first_party": "false",
"description": fmt.Sprintf("Description for client 2 %s", t.Name()),
}),
),
},
{
Config: acctest.ParseTestName(testAccGivenSomeClients+testAccDataClientsWithAppTypeFilter, t.Name()),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttrSet("data.auth0_clients.test", "id"),
resource.TestCheckResourceAttr("data.auth0_clients.test", "clients.#", "1"),
resource.TestCheckResourceAttr("data.auth0_clients.test", "clients.0.app_type", "non_interactive"),
resource.TestCheckResourceAttr("data.auth0_clients.test", "clients.0.name", fmt.Sprintf("Acceptance Test 1 - %v", t.Name())),
resource.TestCheckResourceAttr("data.auth0_clients.test", "clients.0.name", fmt.Sprintf("Acceptance Test %v - 1", t.Name())),
),
},
{
Expand All @@ -111,7 +80,7 @@ func TestAccDataClients(t *testing.T) {
resource.TestCheckResourceAttrSet("data.auth0_clients.test", "id"),
resource.TestCheckResourceAttr("data.auth0_clients.test", "clients.#", "1"),
resource.TestCheckResourceAttr("data.auth0_clients.test", "clients.0.is_first_party", "true"),
resource.TestCheckResourceAttr("data.auth0_clients.test", "clients.0.name", fmt.Sprintf("Acceptance Test 1 - %v", t.Name())),
resource.TestCheckResourceAttr("data.auth0_clients.test", "clients.0.name", fmt.Sprintf("Acceptance Test %v - 1", t.Name())),
),
},
},
Expand Down
1 change: 1 addition & 0 deletions internal/auth0/client/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,7 @@ func NewResource() *schema.Resource {
"oidc_logout": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Description: "Configure OIDC logout for the Client",
Elem: &schema.Resource{
Expand Down
4 changes: 3 additions & 1 deletion internal/auth0/client/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2456,6 +2456,8 @@ resource "auth0_client" "my_client" {
}
}
`

// In this case, the default value should be set for OIDCLogout.
const testAccUpdateClientWithOIDCLogoutWhenRemovedFromConfig = `
resource "auth0_client" "my_client" {
name = "Acceptance Test - OIDC Logout - {{.testName}}"
Expand Down Expand Up @@ -2497,7 +2499,7 @@ func TestAccClientOIDCLogout(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_client.my_client", "name", fmt.Sprintf("Acceptance Test - OIDC Logout - %s", t.Name())),
resource.TestCheckResourceAttr("auth0_client.my_client", "app_type", "spa"),
resource.TestCheckResourceAttr("auth0_client.my_client", "oidc_logout.#", "0"),
resource.TestCheckResourceAttr("auth0_client.my_client", "oidc_logout.#", "1"),
),
},
},
Expand Down
Loading
Loading