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:
parent
a292150087
commit
d42432bfef
@ -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()
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
Reference in New Issue
Block a user