2017-09-07 18:21:44 +00:00
|
|
|
import boto3
|
2022-03-11 21:28:45 +00:00
|
|
|
import sure # noqa # pylint: disable=unused-import
|
2017-09-07 18:21:44 +00:00
|
|
|
from moto import mock_iam
|
|
|
|
|
|
|
|
|
|
|
|
@mock_iam()
|
|
|
|
def test_account_aliases():
|
2019-10-31 15:44:26 +00:00
|
|
|
client = boto3.client("iam", region_name="us-east-1")
|
2017-09-07 18:21:44 +00:00
|
|
|
|
2019-10-31 15:44:26 +00:00
|
|
|
alias = "my-account-name"
|
2017-09-07 18:21:44 +00:00
|
|
|
aliases = client.list_account_aliases()
|
2019-10-31 15:44:26 +00:00
|
|
|
aliases.should.have.key("AccountAliases").which.should.equal([])
|
2017-09-07 18:21:44 +00:00
|
|
|
|
|
|
|
client.create_account_alias(AccountAlias=alias)
|
|
|
|
aliases = client.list_account_aliases()
|
2019-10-31 15:44:26 +00:00
|
|
|
aliases.should.have.key("AccountAliases").which.should.equal([alias])
|
2017-09-07 18:21:44 +00:00
|
|
|
|
|
|
|
client.delete_account_alias(AccountAlias=alias)
|
|
|
|
aliases = client.list_account_aliases()
|
2019-10-31 15:44:26 +00:00
|
|
|
aliases.should.have.key("AccountAliases").which.should.equal([])
|