Merge pull request #2357 from brodie-g/master
Existing user now raises a UsernameExistsException
This commit is contained in:
commit
cc96a5e659
3 changed files with 45 additions and 1 deletions
|
|
@ -886,6 +886,36 @@ def test_admin_create_user():
|
|||
result["User"]["Enabled"].should.equal(True)
|
||||
|
||||
|
||||
@mock_cognitoidp
|
||||
def test_admin_create_existing_user():
|
||||
conn = boto3.client("cognito-idp", "us-west-2")
|
||||
|
||||
username = str(uuid.uuid4())
|
||||
value = str(uuid.uuid4())
|
||||
user_pool_id = conn.create_user_pool(PoolName=str(uuid.uuid4()))["UserPool"]["Id"]
|
||||
conn.admin_create_user(
|
||||
UserPoolId=user_pool_id,
|
||||
Username=username,
|
||||
UserAttributes=[
|
||||
{"Name": "thing", "Value": value}
|
||||
],
|
||||
)
|
||||
|
||||
caught = False
|
||||
try:
|
||||
conn.admin_create_user(
|
||||
UserPoolId=user_pool_id,
|
||||
Username=username,
|
||||
UserAttributes=[
|
||||
{"Name": "thing", "Value": value}
|
||||
],
|
||||
)
|
||||
except conn.exceptions.UsernameExistsException:
|
||||
caught = True
|
||||
|
||||
caught.should.be.true
|
||||
|
||||
|
||||
@mock_cognitoidp
|
||||
def test_admin_get_user():
|
||||
conn = boto3.client("cognito-idp", "us-west-2")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue