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

@ -383,7 +383,7 @@ class CognitoIdpBackend(BaseBackend):
raise ResourceNotFoundError(user_pool_id)
if username not in user_pool.users:
raise ResourceNotFoundError(username)
raise UserNotFoundError(username)
return user_pool.users[username]
@ -408,7 +408,7 @@ class CognitoIdpBackend(BaseBackend):
raise ResourceNotFoundError(user_pool_id)
if username not in user_pool.users:
raise ResourceNotFoundError(username)
raise UserNotFoundError(username)
del user_pool.users[username]