fix cognito-idp UserPool ClientId (#3165)

* fix cognito-idp UserPool ClientId

* add test

* replace uuid4 to create_id
This commit is contained in:
Koichi Ogura 2020-07-22 22:08:17 +09:00 committed by GitHub
commit 448ff45174
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 deletions

View file

@ -3,6 +3,8 @@ from __future__ import unicode_literals
import json
import os
import random
import re
import requests
import uuid
@ -15,6 +17,7 @@ from jose import jws, jwk, jwt
from nose.tools import assert_raises
from moto import mock_cognitoidp, settings
from moto.cognitoidp.utils import create_id
from moto.core import ACCOUNT_ID
@ -211,7 +214,7 @@ def test_create_user_pool_client():
)
result["UserPoolClient"]["UserPoolId"].should.equal(user_pool_id)
result["UserPoolClient"]["ClientId"].should_not.be.none
bool(re.match(r"^[0-9a-z]{26}$", result["UserPoolClient"]["ClientId"])).should.be.ok
result["UserPoolClient"]["ClientName"].should.equal(client_name)
result["UserPoolClient"].should_not.have.key("ClientSecret")
result["UserPoolClient"]["CallbackURLs"].should.have.length_of(1)
@ -233,7 +236,7 @@ def test_create_user_pool_client_returns_secret():
)
result["UserPoolClient"]["UserPoolId"].should.equal(user_pool_id)
result["UserPoolClient"]["ClientId"].should_not.be.none
bool(re.match(r"^[0-9a-z]{26}$", result["UserPoolClient"]["ClientId"])).should.be.ok
result["UserPoolClient"]["ClientName"].should.equal(client_name)
result["UserPoolClient"]["ClientSecret"].should_not.be.none
result["UserPoolClient"]["CallbackURLs"].should.have.length_of(1)
@ -1334,9 +1337,7 @@ def test_change_password__using_custom_user_agent_header():
def test_forgot_password():
conn = boto3.client("cognito-idp", "us-west-2")
result = conn.forgot_password(
ClientId=str(uuid.uuid4()), Username=str(uuid.uuid4())
)
result = conn.forgot_password(ClientId=create_id(), Username=str(uuid.uuid4()))
result["CodeDeliveryDetails"].should_not.be.none