Add iam.delete_account_password_policy
This commit is contained in:
parent
65fa8f1a1b
commit
89c43820c9
@ -3286,7 +3286,7 @@
|
||||
- [X] deactivate_mfa_device
|
||||
- [X] delete_access_key
|
||||
- [X] delete_account_alias
|
||||
- [ ] delete_account_password_policy
|
||||
- [X] delete_account_password_policy
|
||||
- [ ] delete_group
|
||||
- [ ] delete_group_policy
|
||||
- [ ] delete_instance_profile
|
||||
|
@ -1678,5 +1678,11 @@ class IAMBackend(BaseBackend):
|
||||
|
||||
return self.account_password_policy
|
||||
|
||||
def delete_account_password_policy(self):
|
||||
if not self.account_password_policy:
|
||||
raise NoSuchEntity('The account policy with name PasswordPolicy cannot be found.')
|
||||
|
||||
self.account_password_policy = None
|
||||
|
||||
|
||||
iam_backend = IAMBackend()
|
||||
|
@ -863,6 +863,12 @@ class IamResponse(BaseResponse):
|
||||
template = self.response_template(GET_ACCOUNT_PASSWORD_POLICY_TEMPLATE)
|
||||
return template.render(password_policy=account_password_policy)
|
||||
|
||||
def delete_account_password_policy(self):
|
||||
iam_backend.delete_account_password_policy()
|
||||
|
||||
template = self.response_template(DELETE_ACCOUNT_PASSWORD_POLICY_TEMPLATE)
|
||||
return template.render()
|
||||
|
||||
|
||||
LIST_ENTITIES_FOR_POLICY_TEMPLATE = """<ListEntitiesForPolicyResponse>
|
||||
<ListEntitiesForPolicyResult>
|
||||
@ -2229,3 +2235,10 @@ GET_ACCOUNT_PASSWORD_POLICY_TEMPLATE = """<GetAccountPasswordPolicyResponse xmln
|
||||
<RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
|
||||
</ResponseMetadata>
|
||||
</GetAccountPasswordPolicyResponse>"""
|
||||
|
||||
|
||||
DELETE_ACCOUNT_PASSWORD_POLICY_TEMPLATE = """<DeleteAccountPasswordPolicyResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
|
||||
<ResponseMetadata>
|
||||
<RequestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</RequestId>
|
||||
</ResponseMetadata>
|
||||
</DeleteAccountPasswordPolicyResponse>"""
|
||||
|
@ -2274,3 +2274,30 @@ def test_get_account_password_policy_errors():
|
||||
ClientError,
|
||||
'The Password Policy with domain name 123456789012 cannot be found.'
|
||||
)
|
||||
|
||||
|
||||
@mock_iam
|
||||
def test_delete_account_password_policy():
|
||||
client = boto3.client('iam', region_name='us-east-1')
|
||||
client.update_account_password_policy()
|
||||
|
||||
response = client.get_account_password_policy()
|
||||
|
||||
response.should.have.key('PasswordPolicy').which.should.be.a(dict)
|
||||
|
||||
client.delete_account_password_policy()
|
||||
|
||||
client.get_account_password_policy.when.called_with().should.throw(
|
||||
ClientError,
|
||||
'The Password Policy with domain name 123456789012 cannot be found.'
|
||||
)
|
||||
|
||||
|
||||
@mock_iam
|
||||
def test_delete_account_password_policy_errors():
|
||||
client = boto3.client('iam', region_name='us-east-1')
|
||||
|
||||
client.delete_account_password_policy.when.called_with().should.throw(
|
||||
ClientError,
|
||||
'The account policy with name PasswordPolicy cannot be found.'
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user