Skip to content

Commit

Permalink
Merge pull request #94 from auth0/patch/DXCDT-80-client
Browse files Browse the repository at this point in the history
DXCDT-94 Stop ignoring errors when setting resource data within the client
  • Loading branch information
sergiught authored Mar 30, 2022
2 parents 8dcae01 + ef2fc30 commit 0ea12de
Show file tree
Hide file tree
Showing 4 changed files with 280 additions and 162 deletions.
1 change: 0 additions & 1 deletion auth0/data_source_auth0_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ func newDataClient() *schema.Resource {
func newClientSchema() map[string]*schema.Schema {
clientSchema := datasourceSchemaFromResourceSchema(newClient().Schema)
delete(clientSchema, "client_secret_rotation_trigger")
delete(clientSchema, "client_secret")
addOptionalFieldsToSchema(clientSchema, "name", "client_id")
return clientSchema
}
Expand Down
10 changes: 7 additions & 3 deletions auth0/data_source_auth0_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ func TestAccDataClientByName(t *testing.T) {
PreventPostDestroyRefresh: true,
Steps: []resource.TestStep{
{
Config: random.Template(testAccClientConfig, rand), // must initialize resource before reading with data source
Config: random.Template(testAccClientConfig, rand),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_client.my_client", "name", fmt.Sprintf("Acceptance Test - %v", rand)),
), // check that the client got created correctly before using the data source
},
{
Config: random.Template(fmt.Sprintf(testAccDataClientConfigByName, testAccClientConfig), rand),
Expand All @@ -44,7 +47,6 @@ func TestAccDataClientByName(t *testing.T) {
resource.TestCheckResourceAttr("data.auth0_client.test", "name", fmt.Sprintf("Acceptance Test - %v", rand)),
resource.TestCheckResourceAttr("data.auth0_client.test", "app_type", "non_interactive"), // Arbitrary property selection
resource.TestCheckNoResourceAttr("data.auth0_client.test", "client_secret_rotation_trigger"),
resource.TestCheckNoResourceAttr("data.auth0_client.test", "client_secret"),
),
},
},
Expand All @@ -62,6 +64,9 @@ func TestAccDataClientById(t *testing.T) {
Steps: []resource.TestStep{
{
Config: random.Template(testAccClientConfig, rand),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("auth0_client.my_client", "name", fmt.Sprintf("Acceptance Test - %v", rand)),
), // check that the client got created correctly before using the data source
},
{
Config: random.Template(fmt.Sprintf(testAccDataClientConfigById, testAccClientConfig), rand),
Expand All @@ -70,7 +75,6 @@ func TestAccDataClientById(t *testing.T) {
resource.TestCheckResourceAttrSet("data.auth0_client.test", "name"),
resource.TestCheckResourceAttr("data.auth0_client.test", "signing_keys.#", "1"), // checks that signing_keys is set, and it includes 1 element
resource.TestCheckNoResourceAttr("data.auth0_client.test", "client_secret_rotation_trigger"),
resource.TestCheckNoResourceAttr("data.auth0_client.test", "client_secret"),
),
},
},
Expand Down
1 change: 0 additions & 1 deletion auth0/data_source_auth0_global_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ func TestAccDataGlobalClient(t *testing.T) {
resource.TestCheckResourceAttrSet("data.auth0_global_client.global", "client_id"),
resource.TestCheckResourceAttr("data.auth0_global_client.global", "app_type", ""),
resource.TestCheckResourceAttr("data.auth0_global_client.global", "name", "All Applications"),
resource.TestCheckNoResourceAttr("data.auth0_global_client.global", "client_secret"),
),
},
},
Expand Down
Loading

0 comments on commit 0ea12de

Please sign in to comment.