Implemented IAM delete_instance_profile (#3020)

* Implemented IAM delete_instance_profile

* PR adjustment: positively verifying instance profile deletion in test case.

Co-authored-by: Joseph Weitekamp <jweite@amazon.com>
This commit is contained in:
jweite 2020-05-27 13:22:06 -04:00 committed by GitHub
commit 4303123312
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 0 deletions

View file

@ -206,6 +206,26 @@ def test_remove_role_from_instance_profile():
dict(profile.roles).should.be.empty
@mock_iam()
def test_delete_instance_profile():
conn = boto3.client("iam", region_name="us-east-1")
conn.create_role(
RoleName="my-role", AssumeRolePolicyDocument="some policy", Path="/my-path/"
)
conn.create_instance_profile(InstanceProfileName="my-profile")
conn.add_role_to_instance_profile(
InstanceProfileName="my-profile", RoleName="my-role"
)
with assert_raises(conn.exceptions.DeleteConflictException):
conn.delete_instance_profile(InstanceProfileName="my-profile")
conn.remove_role_from_instance_profile(
InstanceProfileName="my-profile", RoleName="my-role"
)
conn.delete_instance_profile(InstanceProfileName="my-profile")
with assert_raises(conn.exceptions.NoSuchEntityException):
profile = conn.get_instance_profile(InstanceProfileName="my-profile")
@mock_iam()
def test_get_login_profile():
conn = boto3.client("iam", region_name="us-east-1")