2017-09-07 18:21:44 +00:00
|
|
|
import boto3
|
|
|
|
from moto import mock_iam
|
|
|
|
|
|
|
|
|
|
|
|
@mock_iam()
|
|
|
|
def test_account_aliases():
|
|
|
|
client = boto3.client("iam", region_name="us-east-1")
|
|
|
|
|
|
|
|
alias = "my-account-name"
|
|
|
|
aliases = client.list_account_aliases()
|
2023-07-30 19:37:08 +00:00
|
|
|
assert aliases["AccountAliases"] == []
|
2017-09-07 18:21:44 +00:00
|
|
|
|
|
|
|
client.create_account_alias(AccountAlias=alias)
|
|
|
|
aliases = client.list_account_aliases()
|
2023-07-30 19:37:08 +00:00
|
|
|
assert aliases["AccountAliases"] == [alias]
|
2017-09-07 18:21:44 +00:00
|
|
|
|
|
|
|
client.delete_account_alias(AccountAlias=alias)
|
|
|
|
aliases = client.list_account_aliases()
|
2023-07-30 19:37:08 +00:00
|
|
|
assert aliases["AccountAliases"] == []
|