IAM: raise error if requiested instance profile does not exist (#802)

Signed-off-by: Andrew Harris <andrew.harris@getbraintree.com>
This commit is contained in:
Jesse Szwedko 2017-01-18 18:36:50 -08:00 committed by Steve Pulec
parent a292150087
commit d42432bfef
2 changed files with 10 additions and 0 deletions

View File

@ -501,6 +501,8 @@ class IAMBackend(BaseBackend):
if profile.name == profile_name:
return profile
raise IAMNotFoundException("Instance profile {0} not found".format(profile_name))
def get_instance_profiles(self):
return self.instance_profiles.values()

View File

@ -62,6 +62,14 @@ def test_get_role__should_throw__when_role_does_not_exist():
conn.get_role('unexisting_role')
@mock_iam()
@raises(BotoServerError)
def test_get_instance_profile__should_throw__when_instance_profile_does_not_exist():
conn = boto.connect_iam()
conn.get_instance_profile('unexisting_instance_profile')
@mock_iam()
def test_create_role_and_instance_profile():
conn = boto.connect_iam()