Missing users now raise a UserNotFoundException

A missing user in a cognito user pool has raises a UserNotFoundException,
not a ResourceNotFoundException. This commit corrects the behaviour so
that the correct exception is raised
This commit is contained in:
George Alton 2018-10-17 18:39:52 +01:00
commit 2d2708cfd7
No known key found for this signature in database
GPG key ID: BF2E281ABF61709E
2 changed files with 19 additions and 3 deletions

View file

@ -368,6 +368,22 @@ def test_admin_get_user():
result["UserAttributes"][0]["Value"].should.equal(value)
@mock_cognitoidp
def test_admin_get_missing_user():
conn = boto3.client("cognito-idp", "us-west-2")
username = str(uuid.uuid4())
user_pool_id = conn.create_user_pool(PoolName=str(uuid.uuid4()))["UserPool"]["Id"]
caught = False
try:
conn.admin_get_user(UserPoolId=user_pool_id, Username=username)
except conn.exceptions.UserNotFoundException:
caught = True
caught.should.be.true
@mock_cognitoidp
def test_list_users():
conn = boto3.client("cognito-idp", "us-west-2")
@ -423,7 +439,7 @@ def test_admin_delete_user():
caught = False
try:
conn.admin_get_user(UserPoolId=user_pool_id, Username=username)
except conn.exceptions.ResourceNotFoundException:
except conn.exceptions.UserNotFoundException:
caught = True
caught.should.be.true