2023-10-18 18:29:20 +00:00
|
|
|
import boto3
|
|
|
|
|
2024-01-07 12:03:33 +00:00
|
|
|
from moto import mock_aws
|
2023-10-18 18:29:20 +00:00
|
|
|
|
|
|
|
# See our Development Tips on writing tests for hints on how to write good tests:
|
|
|
|
# http://docs.getmoto.org/en/latest/docs/contributing/development_tips/tests.html
|
|
|
|
|
|
|
|
|
2024-01-07 12:03:33 +00:00
|
|
|
@mock_aws
|
2023-10-18 18:29:20 +00:00
|
|
|
def test_deleted_accounts():
|
|
|
|
client = boto3.client("inspector2", region_name="us-east-1")
|
|
|
|
|
|
|
|
assert client.list_delegated_admin_accounts()["delegatedAdminAccounts"] == []
|
|
|
|
|
|
|
|
resp = client.enable_delegated_admin_account(delegatedAdminAccountId="111111111111")
|
|
|
|
assert resp["delegatedAdminAccountId"] == "111111111111"
|
|
|
|
|
|
|
|
assert client.list_delegated_admin_accounts()["delegatedAdminAccounts"] == [
|
|
|
|
{"accountId": "111111111111", "status": "ENABLED"}
|
|
|
|
]
|
|
|
|
|
|
|
|
resp = client.disable_delegated_admin_account(
|
|
|
|
delegatedAdminAccountId="111111111111"
|
|
|
|
)
|
|
|
|
assert resp["delegatedAdminAccountId"] == "111111111111"
|
|
|
|
|
|
|
|
assert client.list_delegated_admin_accounts()["delegatedAdminAccounts"] == [
|
|
|
|
{"accountId": "111111111111", "status": "DISABLED"}
|
|
|
|
]
|