How to use create_cognito_user_pool_client method in localstack

Best Python code snippet using localstack_python

cli.py

Source:cli.py Github

copy

Full Screen

...136 }137 }138 cognito_identity_client.set_identity_pool_roles(**kwargs)139 return identity_pool_id140def create_cognito_user_pool_client(cognito_idp_client, user_pool_id, client_name, cognito_user_pool_client_file):141 # type: ('boto3.client("cognito-idp")', str, str, str) -> None142 user_pool_clients = cognito_idp_client.list_user_pool_clients(UserPoolId=user_pool_id, MaxResults=60)143 for user_pool_client in user_pool_clients['UserPoolClients']:144 if user_pool_client['ClientName'] == client_name:145 return146 # user pool client not found, create it147 kwargs = json.loads(get_file_contents(cognito_user_pool_client_file))148 kwargs['UserPoolId'] = user_pool_id149 kwargs['ClientName'] = client_name150 cognito_idp_client.create_user_pool_client(**kwargs)151def create_cognito_user_pool_group(cognito_idp_client, user_pool_id, group_name):152 kwargs = {153 "UserPoolId": user_pool_id,154 "Limit": 60155 }156 while True:157 response = cognito_idp_client.list_groups(**kwargs)158 for group in response['Groups']:159 if group['GroupName'] == group_name:160 return161 # yield from response['events']162 try:163 kwargs['NextToken'] = response['NextToken']164 except KeyError:165 break166 # group not found, create it167 cognito_idp_client.create_group(168 GroupName=group_name,169 UserPoolId=user_pool_id170 )171def update_iam_user_praktikos(iam_client, user_name, group_name="praktikos"):172 # type: ('boto3.client("iam")', str, str) -> None173 filename = path.abspath(path.join(configs_directory, "iam_user_and_group_policy_arns.json"))174 with open(filename, 'r') as fd:175 policy_arns = json.loads(fd.read())176 update_iam_user_and_group_policies(iam_client, user_name, group_name, policy_arns)177def create_cognito_user_pool_praktikos(cognito_idp_client):178 filename = path.abspath(path.join(configs_directory, "cognito_user_pool.json"))179 with open(filename, 'r') as fd:180 cognito_user_pool = json.loads(fd.read())181 user_pool_id = create_cognito_user_pool(cognito_idp_client, cognito_user_pool)182 filename = path.abspath(path.join(configs_directory, "cognito_user_pool_client.json"))183 create_cognito_user_pool_client(cognito_idp_client, user_pool_id, "praktikos", filename)184 create_cognito_user_pool_group(cognito_idp_client, user_pool_id, "authenticated")185 return user_pool_id186def create_cognito_identity_pool_praktikos(cognito_identity_client, iam_client):187 auth_filename = path.abspath(path.join(configs_directory, "trust_policy_cognito_auth.json"))188 unauth_filename = path.abspath(path.join(configs_directory, "trust_policy_cognito_unauth.json"))189 return create_cognito_identity_pool(cognito_identity_client,190 iam_client,191 "praktikos",192 True,193 auth_filename,194 unauth_filename195 )196def configure_aws():197 """...

Full Screen

Full Screen

apigateway_fixtures.py

Source:apigateway_fixtures.py Github

copy

Full Screen

...89 return response.get("UserPool").get("Id"), response.get("UserPool").get("Arn")90def delete_cognito_user_pool(cognito_idp, **kwargs):91 response = cognito_idp.delete_user_pool(**kwargs)92 assert_response_is_200(response)93def create_cognito_user_pool_client(cognito_idp, **kwargs):94 response = cognito_idp.create_user_pool_client(**kwargs)95 assert_response_is_200(response)96 return (97 response.get("UserPoolClient").get("ClientId"),98 response.get("UserPoolClient").get("ClientName"),99 )100def create_cognito_user(cognito_idp, **kwargs):101 response = cognito_idp.sign_up(**kwargs)102 assert_response_is_200(response)103def create_cognito_sign_up_confirmation(cognito_idp, **kwargs):104 response = cognito_idp.admin_confirm_sign_up(**kwargs)105 assert_response_is_200(response)106def create_initiate_auth(cognito_idp, **kwargs):107 response = cognito_idp.initiate_auth(**kwargs)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful