Skip to content

Commit

Permalink
added all fields test
Browse files Browse the repository at this point in the history
  • Loading branch information
psyvision committed Dec 11, 2017
1 parent 622633f commit dddba8e
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions aws/resource_aws_cognito_user_pool_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,27 @@ func TestAccAWSCognitoUserPoolClient_basic(t *testing.T) {
})
}

func TestAccAWSCognitoUserPoolClient_allFields(t *testing.T) {
name := acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSCognitoUserPoolClientConfig_basic(name),
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckAWSCognitoUserPoolClientExists("aws_cognito_user_pool_client.client"),
resource.TestCheckResourceAttr("aws_cognito_user_pool_client.client", "name", name),
resource.TestCheckResourceAttr("aws_cognito_user_pool_client.client", "explicit_auth_flows.#", "1"),
resource.TestCheckResourceAttr("aws_cognito_user_pool_client.client", "explicit_auth_flows.0", "ADMIN_NO_SRP_AUTH"),
),
},
},
})
}

func testAccCheckAWSCognitoUserPoolClientDestroy(s *terraform.State) error {
conn := testAccProvider.Meta().(*AWSClient).cognitoidpconn

Expand Down Expand Up @@ -102,3 +123,35 @@ resource "aws_cognito_user_pool" "pool" {
}
`, clientName)
}

func testAccAWSCognitoUserPoolClientConfig_allFields(clientName string) string {
return fmt.Sprintf(`
resource "aws_cognito_user_pool_client" "client" {
name = "%s"
user_pool_id = "${aws_cognito_user_pool.pool.id}"
explicit_auth_flows = [ "ADMIN_NO_SRP_AUTH" ]
generate_secret = "true"
read_attributes = ["username"]
write_attributes = ["username"]
refresh_token_validity = 300
allowed_oauth_flows = ["code", "token"]
allowed_oauth_flows_user_pool_client = "true"
allowed_oauth_scopes = ["openid", "email"]
callback_urls = ["https://www.example.com/callback"]
default_redirect_uri = "https://www.example.com/redirect"
login_urls = ["https://www.example.com/login"]
supported_identity_providers = ["saml_provider_1"]
}
resource "aws_cognito_user_pool" "pool" {
name = "test-pool"
}
`, clientName)
}

0 comments on commit dddba8e

Please sign in to comment.