This repository has been archived by the owner on Mar 8, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reusing existing testAccClientConfig client resource configuration
- Loading branch information
Will Vedder
committed
Feb 4, 2022
1 parent
4905251
commit 56121f7
Showing
1 changed file
with
5 additions
and
81 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 |
---|---|---|
|
@@ -9,82 +9,6 @@ import ( | |
"github.com/hashicorp/terraform-plugin-sdk/terraform" | ||
) | ||
|
||
const testAccDataClientConfigInit = ` | ||
resource "auth0_client" "test" { | ||
name = "Acceptance Test - {{.random}}" | ||
description = "Test Application Long Description" | ||
app_type = "non_interactive" | ||
custom_login_page_on = true | ||
is_first_party = true | ||
is_token_endpoint_ip_header_trusted = true | ||
token_endpoint_auth_method = "client_secret_post" | ||
oidc_conformant = true | ||
callbacks = [ "https://example.com/callback" ] | ||
allowed_origins = [ "https://example.com" ] | ||
allowed_clients = [ "https://allowed.example.com" ] | ||
grant_types = [ "authorization_code", "http://auth0.com/oauth/grant-type/password-realm", "implicit", "password", "refresh_token" ] | ||
organization_usage = "deny" | ||
organization_require_behavior = "no_prompt" | ||
allowed_logout_urls = [ "https://example.com" ] | ||
web_origins = [ "https://example.com" ] | ||
jwt_configuration { | ||
lifetime_in_seconds = 300 | ||
secret_encoded = true | ||
alg = "RS256" | ||
scopes = { | ||
foo = "bar" | ||
} | ||
} | ||
client_metadata = { | ||
foo = "zoo" | ||
} | ||
addons { | ||
firebase = { | ||
client_email = "[email protected]" | ||
lifetime_in_seconds = 1 | ||
private_key = "wer" | ||
private_key_id = "qwreerwerwe" | ||
} | ||
samlp { | ||
audience = "https://example.com/saml" | ||
mappings = { | ||
email = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" | ||
name = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" | ||
} | ||
create_upn_claim = false | ||
passthrough_claims_with_no_mapping = false | ||
map_unknown_claims_as_is = false | ||
map_identities = false | ||
name_identifier_format = "urn:oasis:names:tc:SAML:2.0:nameid-format:persistent" | ||
name_identifier_probes = [ | ||
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" | ||
] | ||
logout = { | ||
callback = "http://example.com/callback" | ||
slo_enabled = true | ||
} | ||
signing_cert = "-----BEGIN PUBLIC KEY-----\nMIGf...bpP/t3\n+JGNGIRMj1hF1rnb6QIDAQAB\n-----END PUBLIC KEY-----\n" | ||
} | ||
} | ||
refresh_token { | ||
leeway = 42 | ||
token_lifetime = 424242 | ||
rotation_type = "rotating" | ||
expiration_type = "expiring" | ||
infinite_token_lifetime = true | ||
infinite_idle_token_lifetime = false | ||
idle_token_lifetime = 3600 | ||
} | ||
mobile { | ||
ios { | ||
team_id = "9JA89QQLNQ" | ||
app_bundle_identifier = "com.my.bundle.id" | ||
} | ||
} | ||
initiate_login_uri = "https://example.com/login" | ||
} | ||
` | ||
|
||
const testAccDataClientConfigByName = ` | ||
%v | ||
data auth0_client test { | ||
|
@@ -109,14 +33,14 @@ func TestAccDataClientByName(t *testing.T) { | |
PreventPostDestroyRefresh: true, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: random.Template(testAccDataClientConfigInit, rand), // must initialize resource before reading with data source | ||
Config: random.Template(testAccClientConfig, rand), // must initialize resource before reading with data source | ||
}, | ||
{ | ||
Config: random.Template(fmt.Sprintf(testAccDataClientConfigByName, testAccDataClientConfigInit), rand), | ||
Config: random.Template(fmt.Sprintf(testAccDataClientConfigByName, testAccClientConfig), rand), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("data.auth0_client.test", "client_id"), | ||
resource.TestCheckResourceAttr("data.auth0_client.test", "name", fmt.Sprintf("Acceptance Test - %v", rand)), | ||
resource.TestCheckResourceAttr("data.auth0_client.test", "app_type", "non_interactive"), | ||
resource.TestCheckResourceAttr("data.auth0_client.test", "app_type", "non_interactive"), // Arbitrary property selection | ||
resource.TestCheckNoResourceAttr("data.auth0_client.test", "client_secret_rotation_trigger"), | ||
), | ||
}, | ||
|
@@ -134,10 +58,10 @@ func TestAccDataClientById(t *testing.T) { | |
PreventPostDestroyRefresh: true, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: random.Template(testAccDataClientConfigInit, rand), | ||
Config: random.Template(testAccClientConfig, rand), | ||
}, | ||
{ | ||
Config: random.Template(fmt.Sprintf(testAccDataClientConfigById, testAccDataClientConfigInit), rand), | ||
Config: random.Template(fmt.Sprintf(testAccDataClientConfigById, testAccClientConfig), rand), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("data.auth0_client.test", "id"), | ||
resource.TestCheckResourceAttrSet("data.auth0_client.test", "name"), | ||
|