diff --git a/moto/cloudformation/responses.py b/moto/cloudformation/responses.py
index 63429a0a7..bf68a6325 100644
--- a/moto/cloudformation/responses.py
+++ b/moto/cloudformation/responses.py
@@ -426,7 +426,9 @@ class CloudFormationResponse(BaseResponse):
stackset = self.cloudformation_backend.get_stack_set(stackset_name)
if not stackset.admin_role:
- stackset.admin_role = "arn:aws:iam::{AccountId}:role/AWSCloudFormationStackSetAdministrationRole".format(AccountId=ACCOUNT_ID)
+ stackset.admin_role = "arn:aws:iam::{AccountId}:role/AWSCloudFormationStackSetAdministrationRole".format(
+ AccountId=ACCOUNT_ID
+ )
if not stackset.execution_role:
stackset.execution_role = "AWSCloudFormationStackSetExecutionRole"
@@ -1052,11 +1054,14 @@ STOP_STACK_SET_OPERATION_RESPONSE_TEMPLATE = """
"""
-DESCRIBE_STACKSET_OPERATION_RESPONSE_TEMPLATE = """
+DESCRIBE_STACKSET_OPERATION_RESPONSE_TEMPLATE = (
+ """
{{ stackset.execution_role }}
- arn:aws:iam::""" + ACCOUNT_ID + """:role/{{ stackset.admin_role }}
+ arn:aws:iam::"""
+ + ACCOUNT_ID
+ + """:role/{{ stackset.admin_role }}
{{ stackset.id }}
{{ operation.CreationTimestamp }}
{{ operation.OperationId }}
@@ -1073,15 +1078,19 @@ DESCRIBE_STACKSET_OPERATION_RESPONSE_TEMPLATE = """
"""
+)
-LIST_STACK_SET_OPERATION_RESULTS_RESPONSE_TEMPLATE = """
+LIST_STACK_SET_OPERATION_RESULTS_RESPONSE_TEMPLATE = (
+ """
{% for instance in operation.Instances %}
{% for account, region in instance.items() %}
- Function not found: arn:aws:lambda:us-west-2:""" + ACCOUNT_ID + """:function:AWSCloudFormationStackSetAccountGate
+ Function not found: arn:aws:lambda:us-west-2:"""
+ + ACCOUNT_ID
+ + """:function:AWSCloudFormationStackSetAccountGate
SKIPPED
{{ region }}
@@ -1097,3 +1106,4 @@ LIST_STACK_SET_OPERATION_RESULTS_RESPONSE_TEMPLATE = """
"""
+)
diff --git a/moto/cloudformation/utils.py b/moto/cloudformation/utils.py
index 6a53e6e51..cd8481002 100644
--- a/moto/cloudformation/utils.py
+++ b/moto/cloudformation/utils.py
@@ -9,6 +9,7 @@ import string
from cfnlint import decode, core
from moto.core import ACCOUNT_ID
+
def generate_stack_id(stack_name, region="us-east-1", account="123456789"):
random_id = uuid.uuid4()
return "arn:aws:cloudformation:{}:{}:stack/{}/{}".format(
diff --git a/moto/config/models.py b/moto/config/models.py
index 0bf602b88..9015762fe 100644
--- a/moto/config/models.py
+++ b/moto/config/models.py
@@ -46,6 +46,7 @@ from moto.core import BaseBackend, BaseModel
from moto.s3.config import s3_config_query
from moto.core import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
+
POP_STRINGS = [
"capitalizeStart",
"CapitalizeStart",
diff --git a/moto/core/access_control.py b/moto/core/access_control.py
index 971c02212..8ba0c3ba1 100644
--- a/moto/core/access_control.py
+++ b/moto/core/access_control.py
@@ -24,7 +24,7 @@ from botocore.awsrequest import AWSRequest
from botocore.credentials import Credentials
from six import string_types
-from moto.core import ACCOUNT_ID
+from moto.core import ACCOUNT_ID
from moto.iam.models import Policy
from moto.iam import iam_backend
from moto.core.exceptions import (
diff --git a/moto/core/models.py b/moto/core/models.py
index cfffff383..3be3bbd8e 100644
--- a/moto/core/models.py
+++ b/moto/core/models.py
@@ -23,8 +23,8 @@ from .utils import (
)
-ACCOUNT_ID = os.environ.get('MOTO_ACCOUNT_ID','123456789012')
-
+ACCOUNT_ID = os.environ.get("MOTO_ACCOUNT_ID", "123456789012")
+
class BaseMockAWS(object):
nested_count = 0
diff --git a/moto/ec2/responses/instances.py b/moto/ec2/responses/instances.py
index 621e5abe7..b9e572d29 100644
--- a/moto/ec2/responses/instances.py
+++ b/moto/ec2/responses/instances.py
@@ -8,6 +8,7 @@ from moto.ec2.utils import filters_from_querystring, dict_from_querystring
from moto.elbv2 import elbv2_backends
from moto.core import ACCOUNT_ID
+
class InstanceResponse(BaseResponse):
def describe_instances(self):
filter_dict = filters_from_querystring(self.querystring)
@@ -246,10 +247,13 @@ class InstanceResponse(BaseResponse):
return EC2_MODIFY_INSTANCE_ATTRIBUTE
-EC2_RUN_INSTANCES = """
+EC2_RUN_INSTANCES = (
+ """
59dbff89-35bd-4eac-99ed-be587EXAMPLE
{{ reservation.id }}
- """ + ACCOUNT_ID + """
+ """
+ + ACCOUNT_ID
+ + """
-
sg-245f6a01
@@ -331,7 +335,9 @@ EC2_RUN_INSTANCES = """
+ """
+ + ACCOUNT_ID
+ + """
in-use
1b:2b:3c:4d:5e:6f
{{ nic.private_ip_address }}
@@ -354,7 +360,9 @@ EC2_RUN_INSTANCES = """
+ """
+ + ACCOUNT_ID
+ + """
{% endif %}
@@ -364,7 +372,9 @@ EC2_RUN_INSTANCES = """
+ """
+ + ACCOUNT_ID
+ + """
{% endif %}
@@ -376,14 +386,18 @@ EC2_RUN_INSTANCES = """
+EC2_DESCRIBE_INSTANCES = (
+ """
fdcdcab1-ae5c-489e-9c33-4637c5dda355
{% for reservation in reservations %}
-
{{ reservation.id }}
- """ + ACCOUNT_ID + """
+ """
+ + ACCOUNT_ID
+ + """
{% for group in reservation.dynamic_group_list %}
-
@@ -476,7 +490,9 @@ EC2_DESCRIBE_INSTANCES = """
+ ABCDE"""
+ + ACCOUNT_ID
+ + """3
{% if instance.get_tags() %}
{% for tag in instance.get_tags() %}
@@ -499,7 +515,9 @@ EC2_DESCRIBE_INSTANCES = """
+ """
+ + ACCOUNT_ID
+ + """
in-use
1b:2b:3c:4d:5e:6f
{{ nic.private_ip_address }}
@@ -526,7 +544,9 @@ EC2_DESCRIBE_INSTANCES = """
+ """
+ + ACCOUNT_ID
+ + """
{% endif %}
@@ -536,7 +556,9 @@ EC2_DESCRIBE_INSTANCES = """
+ """
+ + ACCOUNT_ID
+ + """
{% endif %}
@@ -554,6 +576,7 @@ EC2_DESCRIBE_INSTANCES = """
diff --git a/moto/ec2/responses/security_groups.py b/moto/ec2/responses/security_groups.py
index c2d789ea0..6f2926f61 100644
--- a/moto/ec2/responses/security_groups.py
+++ b/moto/ec2/responses/security_groups.py
@@ -172,12 +172,15 @@ DELETE_GROUP_RESPONSE = """
+DESCRIBE_SECURITY_GROUPS_RESPONSE = (
+ """
59dbff89-35bd-4eac-99ed-be587EXAMPLE
{% for group in groups %}
-
- """ + ACCOUNT_ID + """
+ """
+ + ACCOUNT_ID
+ + """
{{ group.id }}
{{ group.name }}
{{ group.description }}
@@ -197,7 +200,9 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """
+ """
+ + ACCOUNT_ID
+ + """
{{ source_group.id }}
{{ source_group.name }}
@@ -226,7 +231,9 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """
+ """
+ + ACCOUNT_ID
+ + """
{{ source_group.id }}
{{ source_group.name }}
@@ -256,6 +263,7 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """
59dbff89-35bd-4eac-99ed-be587EXAMPLE
diff --git a/moto/ec2/responses/vpc_peering_connections.py b/moto/ec2/responses/vpc_peering_connections.py
index 62ab53401..3bf86af8a 100644
--- a/moto/ec2/responses/vpc_peering_connections.py
+++ b/moto/ec2/responses/vpc_peering_connections.py
@@ -41,7 +41,8 @@ class VPCPeeringConnections(BaseResponse):
return template.render()
-CREATE_VPC_PEERING_CONNECTION_RESPONSE = """
+CREATE_VPC_PEERING_CONNECTION_RESPONSE = (
+ """
7a62c49f-347e-4fc4-9331-6e8eEXAMPLE
@@ -57,7 +58,9 @@ CREATE_VPC_PEERING_CONNECTION_RESPONSE = """
- """ + ACCOUNT_ID + """
+ """
+ + ACCOUNT_ID
+ + """
{{ vpc_pcx.peer_vpc.id }}
@@ -69,8 +72,10 @@ CREATE_VPC_PEERING_CONNECTION_RESPONSE = """
"""
+)
-DESCRIBE_VPC_PEERING_CONNECTIONS_RESPONSE = """
+DESCRIBE_VPC_PEERING_CONNECTIONS_RESPONSE = (
+ """
7a62c49f-347e-4fc4-9331-6e8eEXAMPLE
@@ -83,7 +88,9 @@ DESCRIBE_VPC_PEERING_CONNECTIONS_RESPONSE = """
{{ vpc_pcx.vpc.cidr_block }}
- """ + ACCOUNT_ID + """
+ """
+ + ACCOUNT_ID
+ + """
{{ vpc_pcx.peer_vpc.id }}
{{ vpc_pcx.peer_vpc.cidr_block }}
@@ -102,6 +109,7 @@ DESCRIBE_VPC_PEERING_CONNECTIONS_RESPONSE = """
"""
+)
DELETE_VPC_PEERING_CONNECTION_RESPONSE = """
@@ -110,7 +118,8 @@ DELETE_VPC_PEERING_CONNECTION_RESPONSE = """
"""
-ACCEPT_VPC_PEERING_CONNECTION_RESPONSE = """
+ACCEPT_VPC_PEERING_CONNECTION_RESPONSE = (
+ """
7a62c49f-347e-4fc4-9331-6e8eEXAMPLE
@@ -121,7 +130,9 @@ ACCEPT_VPC_PEERING_CONNECTION_RESPONSE = """
{{ vpc_pcx.vpc.cidr_block }}
- """ + ACCOUNT_ID + """
+ """
+ + ACCOUNT_ID
+ + """
{{ vpc_pcx.peer_vpc.id }}
{{ vpc_pcx.peer_vpc.cidr_block }}
@@ -138,6 +149,7 @@ ACCEPT_VPC_PEERING_CONNECTION_RESPONSE = """
"""
+)
REJECT_VPC_PEERING_CONNECTION_RESPONSE = """
diff --git a/moto/s3/responses.py b/moto/s3/responses.py
index 820f8e2dd..3fa793f25 100644
--- a/moto/s3/responses.py
+++ b/moto/s3/responses.py
@@ -1887,7 +1887,8 @@ S3_MULTIPART_COMPLETE_RESPONSE = """
"""
-S3_ALL_MULTIPARTS = """
+S3_ALL_MULTIPARTS = (
+ """
{{ bucket_name }}
@@ -1899,7 +1900,9 @@ S3_ALL_MULTIPARTS = """
{{ upload.key_name }}
{{ upload.id }}
- arn:aws:iam::""" + ACCOUNT_ID + """:user/user1-11111a31-17b5-4fb7-9df5-b111111f13de
+ arn:aws:iam::"""
+ + ACCOUNT_ID
+ + """:user/user1-11111a31-17b5-4fb7-9df5-b111111f13de
user1-11111a31-17b5-4fb7-9df5-b111111f13de
@@ -1912,6 +1915,7 @@ S3_ALL_MULTIPARTS = """
{% endfor %}
"""
+)
S3_NO_POLICY = """
diff --git a/moto/ses/feedback.py b/moto/ses/feedback.py
index 7161a2c37..b0fa293e7 100644
--- a/moto/ses/feedback.py
+++ b/moto/ses/feedback.py
@@ -1,4 +1,5 @@
from moto.core import ACCOUNT_ID
+
"""
SES Feedback messages
Extracted from https://docs.aws.amazon.com/ses/latest/DeveloperGuide/notification-contents.html
diff --git a/moto/sns/models.py b/moto/sns/models.py
index 920bdada1..67581f60a 100644
--- a/moto/sns/models.py
+++ b/moto/sns/models.py
@@ -32,6 +32,7 @@ from .exceptions import (
from .utils import make_arn_for_topic, make_arn_for_subscription, is_e164
from moto.core import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
+
DEFAULT_PAGE_SIZE = 100
MAXIMUM_MESSAGE_LENGTH = 262144 # 256 KiB
@@ -259,7 +260,9 @@ class Subscription(BaseModel):
"SignatureVersion": "1",
"Signature": "EXAMPLElDMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn/49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7NFhUzLiieYr4BKHpdTmdD6c0esKEYBpabxDSc=",
"SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",
- "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:{}:some-topic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55".format(DEFAULT_ACCOUNT_ID),
+ "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:{}:some-topic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55".format(
+ DEFAULT_ACCOUNT_ID
+ ),
}
if message_attributes:
post_data["MessageAttributes"] = message_attributes
@@ -276,7 +279,10 @@ class PlatformApplication(BaseModel):
@property
def arn(self):
return "arn:aws:sns:{region}:{AccountId}:app/{platform}/{name}".format(
- region=self.region, platform=self.platform, name=self.name, AccountId=DEFAULT_ACCOUNT_ID
+ region=self.region,
+ platform=self.platform,
+ name=self.name,
+ AccountId=DEFAULT_ACCOUNT_ID,
)
diff --git a/moto/sqs/models.py b/moto/sqs/models.py
index 5a9c1b031..4e6282f56 100644
--- a/moto/sqs/models.py
+++ b/moto/sqs/models.py
@@ -33,6 +33,7 @@ from .exceptions import (
)
from moto.core import ACCOUNT_ID as DEFAULT_ACCOUNT_ID
+
DEFAULT_SENDER_ID = "AIDAIT2UOQQY3AUEKVGXU"
MAXIMUM_MESSAGE_LENGTH = 262144 # 256 KiB
diff --git a/tests/test_acm/test_acm.py b/tests/test_acm/test_acm.py
index 52d00b390..b38cd1843 100644
--- a/tests/test_acm/test_acm.py
+++ b/tests/test_acm/test_acm.py
@@ -20,7 +20,9 @@ SERVER_CRT = _GET_RESOURCE("star_moto_com.pem")
SERVER_COMMON_NAME = "*.moto.com"
SERVER_CRT_BAD = _GET_RESOURCE("star_moto_com-bad.pem")
SERVER_KEY = _GET_RESOURCE("star_moto_com.key")
-BAD_ARN = "arn:aws:acm:us-east-2:{}:certificate/_0000000-0000-0000-0000-000000000000".format(ACCOUNT_ID)
+BAD_ARN = "arn:aws:acm:us-east-2:{}:certificate/_0000000-0000-0000-0000-000000000000".format(
+ ACCOUNT_ID
+)
def _import_cert(client):
diff --git a/tests/test_apigateway/test_apigateway.py b/tests/test_apigateway/test_apigateway.py
index 72f2833c8..59c0c07f6 100644
--- a/tests/test_apigateway/test_apigateway.py
+++ b/tests/test_apigateway/test_apigateway.py
@@ -882,7 +882,9 @@ def test_put_integration_validation():
client.put_integration(
restApiId=api_id,
resourceId=root_id,
- credentials="arn:aws:iam::{}:role/service-role/testfunction-role-oe783psq".format(ACCOUNT_ID),
+ credentials="arn:aws:iam::{}:role/service-role/testfunction-role-oe783psq".format(
+ ACCOUNT_ID
+ ),
httpMethod="GET",
type=type,
uri="arn:aws:apigateway:us-west-2:s3:path/b/k",
@@ -904,7 +906,9 @@ def test_put_integration_validation():
client.put_integration(
restApiId=api_id,
resourceId=root_id,
- credentials="arn:aws:iam::{}:role/service-role/testfunction-role-oe783psq".format(ACCOUNT_ID),
+ credentials="arn:aws:iam::{}:role/service-role/testfunction-role-oe783psq".format(
+ ACCOUNT_ID
+ ),
httpMethod="GET",
type=type,
uri="arn:aws:apigateway:us-west-2:s3:path/b/k",
diff --git a/tests/test_autoscaling/test_launch_configurations.py b/tests/test_autoscaling/test_launch_configurations.py
index 99e078cb3..ab2743f54 100644
--- a/tests/test_autoscaling/test_launch_configurations.py
+++ b/tests/test_autoscaling/test_launch_configurations.py
@@ -23,7 +23,9 @@ def test_create_launch_configuration():
security_groups=["default", "default2"],
user_data=b"This is some user_data",
instance_monitoring=True,
- instance_profile_name="arn:aws:iam::{}:instance-profile/testing".format(ACCOUNT_ID),
+ instance_profile_name="arn:aws:iam::{}:instance-profile/testing".format(
+ ACCOUNT_ID
+ ),
spot_price=0.1,
)
conn.create_launch_configuration(config)
@@ -72,7 +74,9 @@ def test_create_launch_configuration_with_block_device_mappings():
security_groups=["default", "default2"],
user_data=b"This is some user_data",
instance_monitoring=True,
- instance_profile_name="arn:aws:iam::{}:instance-profile/testing".format(ACCOUNT_ID),
+ instance_profile_name="arn:aws:iam::{}:instance-profile/testing".format(
+ ACCOUNT_ID
+ ),
spot_price=0.1,
block_device_mappings=[block_device_mapping],
)
diff --git a/tests/test_awslambda/test_lambda.py b/tests/test_awslambda/test_lambda.py
index 264ba9b2b..6fd97e325 100644
--- a/tests/test_awslambda/test_lambda.py
+++ b/tests/test_awslambda/test_lambda.py
@@ -758,7 +758,8 @@ def test_tags_not_found():
).should.throw(botocore.client.ClientError)
conn.untag_resource.when.called_with(
- Resource="arn:aws:lambda:{}:function:not-found".format(ACCOUNT_ID), TagKeys=["spam"]
+ Resource="arn:aws:lambda:{}:function:not-found".format(ACCOUNT_ID),
+ TagKeys=["spam"],
).should.throw(botocore.client.ClientError)
@@ -921,18 +922,15 @@ def test_list_versions_by_function():
assert res["ResponseMetadata"]["HTTPStatusCode"] == 201
versions = conn.list_versions_by_function(FunctionName="testFunction")
assert len(versions["Versions"]) == 3
- assert (
- versions["Versions"][0]["FunctionArn"]
- == "arn:aws:lambda:us-west-2:{}:function:testFunction:$LATEST".format(ACCOUNT_ID)
- )
- assert (
- versions["Versions"][1]["FunctionArn"]
- == "arn:aws:lambda:us-west-2:{}:function:testFunction:1".format(ACCOUNT_ID)
- )
- assert (
- versions["Versions"][2]["FunctionArn"]
- == "arn:aws:lambda:us-west-2:{}:function:testFunction:2".format(ACCOUNT_ID)
- )
+ assert versions["Versions"][0][
+ "FunctionArn"
+ ] == "arn:aws:lambda:us-west-2:{}:function:testFunction:$LATEST".format(ACCOUNT_ID)
+ assert versions["Versions"][1][
+ "FunctionArn"
+ ] == "arn:aws:lambda:us-west-2:{}:function:testFunction:1".format(ACCOUNT_ID)
+ assert versions["Versions"][2][
+ "FunctionArn"
+ ] == "arn:aws:lambda:us-west-2:{}:function:testFunction:2".format(ACCOUNT_ID)
conn.create_function(
FunctionName="testFunction_2",
@@ -947,9 +945,10 @@ def test_list_versions_by_function():
)
versions = conn.list_versions_by_function(FunctionName="testFunction_2")
assert len(versions["Versions"]) == 1
- assert (
- versions["Versions"][0]["FunctionArn"]
- == "arn:aws:lambda:us-west-2:{}:function:testFunction_2:$LATEST".format(ACCOUNT_ID)
+ assert versions["Versions"][0][
+ "FunctionArn"
+ ] == "arn:aws:lambda:us-west-2:{}:function:testFunction_2:$LATEST".format(
+ ACCOUNT_ID
)
diff --git a/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py b/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py
index b8ea7d8f7..40fb2d669 100644
--- a/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py
+++ b/tests/test_cloudformation/test_cloudformation_stack_crud_boto3.py
@@ -298,9 +298,7 @@ def test_boto3_list_stack_set_operation_results():
)
response["Summaries"].should.have.length_of(3)
- response["Summaries"][0].should.have.key("Account").which.should.equal(
- ACCOUNT_ID
- )
+ response["Summaries"][0].should.have.key("Account").which.should.equal(ACCOUNT_ID)
response["Summaries"][1].should.have.key("Status").which.should.equal("STOPPED")
diff --git a/tests/test_cloudformation/test_cloudformation_stack_integration.py b/tests/test_cloudformation/test_cloudformation_stack_integration.py
index 0ae41d7b2..e296ef2ed 100644
--- a/tests/test_cloudformation/test_cloudformation_stack_integration.py
+++ b/tests/test_cloudformation/test_cloudformation_stack_integration.py
@@ -1934,7 +1934,9 @@ def test_stack_spot_fleet():
"SecurityGroups": [{"GroupId": "sg-123"}],
"SubnetId": subnet_id,
"IamInstanceProfile": {
- "Arn": "arn:aws:iam::{}:role/fleet".format(ACCOUNT_ID)
+ "Arn": "arn:aws:iam::{}:role/fleet".format(
+ ACCOUNT_ID
+ )
},
"WeightedCapacity": "4",
"SpotPrice": "10.00",
@@ -2019,7 +2021,9 @@ def test_stack_spot_fleet_should_figure_out_default_price():
"SecurityGroups": [{"GroupId": "sg-123"}],
"SubnetId": subnet_id,
"IamInstanceProfile": {
- "Arn": "arn:aws:iam::{}:role/fleet".format(ACCOUNT_ID)
+ "Arn": "arn:aws:iam::{}:role/fleet".format(
+ ACCOUNT_ID
+ )
},
"WeightedCapacity": "4",
},
diff --git a/tests/test_cognitoidentity/test_cognitoidentity.py b/tests/test_cognitoidentity/test_cognitoidentity.py
index 33a8aeab1..8eae183c6 100644
--- a/tests/test_cognitoidentity/test_cognitoidentity.py
+++ b/tests/test_cognitoidentity/test_cognitoidentity.py
@@ -8,6 +8,7 @@ from moto import mock_cognitoidentity
from moto.cognitoidentity.utils import get_random_identity_id
from moto.core import ACCOUNT_ID
+
@mock_cognitoidentity
def test_create_identity_pool():
conn = boto3.client("cognito-identity", "us-west-2")
@@ -17,7 +18,9 @@ def test_create_identity_pool():
AllowUnauthenticatedIdentities=False,
SupportedLoginProviders={"graph.facebook.com": "123456789012345"},
DeveloperProviderName="devname",
- OpenIdConnectProviderARNs=["arn:aws:rds:eu-west-2:{}:db:mysql-db".format(ACCOUNT_ID)],
+ OpenIdConnectProviderARNs=[
+ "arn:aws:rds:eu-west-2:{}:db:mysql-db".format(ACCOUNT_ID)
+ ],
CognitoIdentityProviders=[
{
"ProviderName": "testprovider",
@@ -39,7 +42,9 @@ def test_describe_identity_pool():
AllowUnauthenticatedIdentities=False,
SupportedLoginProviders={"graph.facebook.com": "123456789012345"},
DeveloperProviderName="devname",
- OpenIdConnectProviderARNs=["arn:aws:rds:eu-west-2:{}:db:mysql-db".format(ACCOUNT_ID)],
+ OpenIdConnectProviderARNs=[
+ "arn:aws:rds:eu-west-2:{}:db:mysql-db".format(ACCOUNT_ID)
+ ],
CognitoIdentityProviders=[
{
"ProviderName": "testprovider",
diff --git a/tests/test_cognitoidp/test_cognitoidp.py b/tests/test_cognitoidp/test_cognitoidp.py
index 754c11d03..7ac1038b0 100644
--- a/tests/test_cognitoidp/test_cognitoidp.py
+++ b/tests/test_cognitoidp/test_cognitoidp.py
@@ -133,7 +133,9 @@ def test_create_user_pool_domain_custom_domain_config():
domain = str(uuid.uuid4())
custom_domain_config = {
- "CertificateArn": "arn:aws:acm:us-east-1:{}:certificate/123456789012".format(ACCOUNT_ID)
+ "CertificateArn": "arn:aws:acm:us-east-1:{}:certificate/123456789012".format(
+ ACCOUNT_ID
+ )
}
user_pool_id = conn.create_user_pool(PoolName=str(uuid.uuid4()))["UserPool"]["Id"]
result = conn.create_user_pool_domain(
@@ -178,7 +180,9 @@ def test_update_user_pool_domain():
domain = str(uuid.uuid4())
custom_domain_config = {
- "CertificateArn": "arn:aws:acm:us-east-1:{}:certificate/123456789012".format(ACCOUNT_ID)
+ "CertificateArn": "arn:aws:acm:us-east-1:{}:certificate/123456789012".format(
+ ACCOUNT_ID
+ )
}
user_pool_id = conn.create_user_pool(PoolName=str(uuid.uuid4()))["UserPool"]["Id"]
conn.create_user_pool_domain(UserPoolId=user_pool_id, Domain=domain)
diff --git a/tests/test_config/test_config.py b/tests/test_config/test_config.py
index 146683c90..d5ec8f0bc 100644
--- a/tests/test_config/test_config.py
+++ b/tests/test_config/test_config.py
@@ -9,6 +9,7 @@ from moto import mock_s3
from moto.config import mock_config
from moto.core import ACCOUNT_ID
+
@mock_config
def test_put_configuration_recorder():
client = boto3.client("config", region_name="us-west-2")
@@ -397,7 +398,9 @@ def test_put_configuration_aggregator():
account_aggregation_source
]
assert (
- "arn:aws:config:us-west-2:{}:config-aggregator/config-aggregator-".format(ACCOUNT_ID)
+ "arn:aws:config:us-west-2:{}:config-aggregator/config-aggregator-".format(
+ ACCOUNT_ID
+ )
in result["ConfigurationAggregator"]["ConfigurationAggregatorArn"]
)
assert (
@@ -626,9 +629,10 @@ def test_put_aggregation_authorization():
Tags=[{"Key": "tag", "Value": "a"}],
)
- assert (
- result["AggregationAuthorization"]["AggregationAuthorizationArn"]
- == "arn:aws:config:us-west-2:{}:aggregation-authorization/012345678910/us-east-1".format(ACCOUNT_ID)
+ assert result["AggregationAuthorization"][
+ "AggregationAuthorizationArn"
+ ] == "arn:aws:config:us-west-2:{}:aggregation-authorization/012345678910/us-east-1".format(
+ ACCOUNT_ID
)
assert result["AggregationAuthorization"]["AuthorizedAccountId"] == "012345678910"
assert result["AggregationAuthorization"]["AuthorizedAwsRegion"] == "us-east-1"
@@ -640,9 +644,10 @@ def test_put_aggregation_authorization():
result = client.put_aggregation_authorization(
AuthorizedAccountId="012345678910", AuthorizedAwsRegion="us-east-1"
)
- assert (
- result["AggregationAuthorization"]["AggregationAuthorizationArn"]
- == "arn:aws:config:us-west-2:{}:aggregation-authorization/012345678910/us-east-1".format(ACCOUNT_ID)
+ assert result["AggregationAuthorization"][
+ "AggregationAuthorizationArn"
+ ] == "arn:aws:config:us-west-2:{}:aggregation-authorization/012345678910/us-east-1".format(
+ ACCOUNT_ID
)
assert result["AggregationAuthorization"]["AuthorizedAccountId"] == "012345678910"
assert result["AggregationAuthorization"]["AuthorizedAwsRegion"] == "us-east-1"
diff --git a/tests/test_ec2/test_spot_fleet.py b/tests/test_ec2/test_spot_fleet.py
index 671b31215..87b2f6291 100644
--- a/tests/test_ec2/test_spot_fleet.py
+++ b/tests/test_ec2/test_spot_fleet.py
@@ -46,7 +46,9 @@ def spot_config(subnet_id, allocation_strategy="lowestPrice"):
],
"Monitoring": {"Enabled": True},
"SubnetId": subnet_id,
- "IamInstanceProfile": {"Arn": "arn:aws:iam::{}:role/fleet".format(ACCOUNT_ID)},
+ "IamInstanceProfile": {
+ "Arn": "arn:aws:iam::{}:role/fleet".format(ACCOUNT_ID)
+ },
"EbsOptimized": False,
"WeightedCapacity": 2.0,
"SpotPrice": "0.13",
@@ -59,7 +61,9 @@ def spot_config(subnet_id, allocation_strategy="lowestPrice"):
"InstanceType": "t2.large",
"Monitoring": {"Enabled": True},
"SubnetId": subnet_id,
- "IamInstanceProfile": {"Arn": "arn:aws:iam::{}:role/fleet".format(ACCOUNT_ID)},
+ "IamInstanceProfile": {
+ "Arn": "arn:aws:iam::{}:role/fleet".format(ACCOUNT_ID)
+ },
"EbsOptimized": False,
"WeightedCapacity": 4.0,
"SpotPrice": "10.00",
diff --git a/tests/test_elb/test_elb.py b/tests/test_elb/test_elb.py
index 1becbe2f1..1583ea544 100644
--- a/tests/test_elb/test_elb.py
+++ b/tests/test_elb/test_elb.py
@@ -77,7 +77,12 @@ def test_create_load_balancer_with_certificate():
zones = ["us-east-1a"]
ports = [
- (443, 8443, "https", "arn:aws:iam:{}:server-certificate/test-cert".format(ACCOUNT_ID))
+ (
+ 443,
+ 8443,
+ "https",
+ "arn:aws:iam:{}:server-certificate/test-cert".format(ACCOUNT_ID),
+ )
]
conn.create_load_balancer("my-lb", zones, ports)
diff --git a/tests/test_elbv2/test_elbv2.py b/tests/test_elbv2/test_elbv2.py
index 77a908e18..eb5df14c3 100644
--- a/tests/test_elbv2/test_elbv2.py
+++ b/tests/test_elbv2/test_elbv2.py
@@ -347,7 +347,11 @@ def test_create_target_group_and_listeners():
Protocol="HTTPS",
Port=443,
Certificates=[
- {"CertificateArn": "arn:aws:iam:{}:server-certificate/test-cert".format(ACCOUNT_ID)}
+ {
+ "CertificateArn": "arn:aws:iam:{}:server-certificate/test-cert".format(
+ ACCOUNT_ID
+ )
+ }
],
DefaultActions=[
{"Type": "forward", "TargetGroupArn": target_group.get("TargetGroupArn")}
@@ -357,7 +361,13 @@ def test_create_target_group_and_listeners():
listener.get("Port").should.equal(443)
listener.get("Protocol").should.equal("HTTPS")
listener.get("Certificates").should.equal(
- [{"CertificateArn": "arn:aws:iam:{}:server-certificate/test-cert".format(ACCOUNT_ID)}]
+ [
+ {
+ "CertificateArn": "arn:aws:iam:{}:server-certificate/test-cert".format(
+ ACCOUNT_ID
+ )
+ }
+ ]
)
listener.get("DefaultActions").should.equal(
[{"TargetGroupArn": target_group.get("TargetGroupArn"), "Type": "forward"}]
@@ -1903,7 +1913,9 @@ def test_cognito_action_listener_rule():
action = {
"Type": "authenticate-cognito",
"AuthenticateCognitoConfig": {
- "UserPoolArn": "arn:aws:cognito-idp:us-east-1:{}:userpool/us-east-1_ABCD1234".format(ACCOUNT_ID),
+ "UserPoolArn": "arn:aws:cognito-idp:us-east-1:{}:userpool/us-east-1_ABCD1234".format(
+ ACCOUNT_ID
+ ),
"UserPoolClientId": "abcd1234abcd",
"UserPoolDomain": "testpool",
},
@@ -1978,7 +1990,9 @@ def test_cognito_action_listener_rule_cloudformation():
{
"Type": "authenticate-cognito",
"AuthenticateCognitoConfig": {
- "UserPoolArn": "arn:aws:cognito-idp:us-east-1:{}:userpool/us-east-1_ABCD1234".format(ACCOUNT_ID),
+ "UserPoolArn": "arn:aws:cognito-idp:us-east-1:{}:userpool/us-east-1_ABCD1234".format(
+ ACCOUNT_ID
+ ),
"UserPoolClientId": "abcd1234abcd",
"UserPoolDomain": "testpool",
},
@@ -2007,7 +2021,9 @@ def test_cognito_action_listener_rule_cloudformation():
{
"Type": "authenticate-cognito",
"AuthenticateCognitoConfig": {
- "UserPoolArn": "arn:aws:cognito-idp:us-east-1:{}:userpool/us-east-1_ABCD1234".format(ACCOUNT_ID),
+ "UserPoolArn": "arn:aws:cognito-idp:us-east-1:{}:userpool/us-east-1_ABCD1234".format(
+ ACCOUNT_ID
+ ),
"UserPoolClientId": "abcd1234abcd",
"UserPoolDomain": "testpool",
},
diff --git a/tests/test_events/test_events.py b/tests/test_events/test_events.py
index 57be06f4c..14d872806 100644
--- a/tests/test_events/test_events.py
+++ b/tests/test_events/test_events.py
@@ -342,7 +342,9 @@ def test_describe_event_bus():
"Effect": "Allow",
"Principal": {"AWS": "arn:aws:iam::111111111111:root"},
"Action": "events:PutEvents",
- "Resource": "arn:aws:events:us-east-1:{}:event-bus/test-bus".format(ACCOUNT_ID),
+ "Resource": "arn:aws:events:us-east-1:{}:event-bus/test-bus".format(
+ ACCOUNT_ID
+ ),
}
],
}
@@ -373,23 +375,33 @@ def test_list_event_buses():
[
{
"Name": "default",
- "Arn": "arn:aws:events:us-east-1:{}:event-bus/default".format(ACCOUNT_ID),
+ "Arn": "arn:aws:events:us-east-1:{}:event-bus/default".format(
+ ACCOUNT_ID
+ ),
},
{
"Name": "other-bus-1",
- "Arn": "arn:aws:events:us-east-1:{}:event-bus/other-bus-1".format(ACCOUNT_ID),
+ "Arn": "arn:aws:events:us-east-1:{}:event-bus/other-bus-1".format(
+ ACCOUNT_ID
+ ),
},
{
"Name": "other-bus-2",
- "Arn": "arn:aws:events:us-east-1:{}:event-bus/other-bus-2".format(ACCOUNT_ID),
+ "Arn": "arn:aws:events:us-east-1:{}:event-bus/other-bus-2".format(
+ ACCOUNT_ID
+ ),
},
{
"Name": "test-bus-1",
- "Arn": "arn:aws:events:us-east-1:{}:event-bus/test-bus-1".format(ACCOUNT_ID),
+ "Arn": "arn:aws:events:us-east-1:{}:event-bus/test-bus-1".format(
+ ACCOUNT_ID
+ ),
},
{
"Name": "test-bus-2",
- "Arn": "arn:aws:events:us-east-1:{}:event-bus/test-bus-2".format(ACCOUNT_ID),
+ "Arn": "arn:aws:events:us-east-1:{}:event-bus/test-bus-2".format(
+ ACCOUNT_ID
+ ),
},
]
)
@@ -401,11 +413,15 @@ def test_list_event_buses():
[
{
"Name": "other-bus-1",
- "Arn": "arn:aws:events:us-east-1:{}:event-bus/other-bus-1".format(ACCOUNT_ID),
+ "Arn": "arn:aws:events:us-east-1:{}:event-bus/other-bus-1".format(
+ ACCOUNT_ID
+ ),
},
{
"Name": "other-bus-2",
- "Arn": "arn:aws:events:us-east-1:{}:event-bus/other-bus-2".format(ACCOUNT_ID),
+ "Arn": "arn:aws:events:us-east-1:{}:event-bus/other-bus-2".format(
+ ACCOUNT_ID
+ ),
},
]
)
@@ -427,7 +443,9 @@ def test_delete_event_bus():
[
{
"Name": "default",
- "Arn": "arn:aws:events:us-east-1:{}:event-bus/default".format(ACCOUNT_ID),
+ "Arn": "arn:aws:events:us-east-1:{}:event-bus/default".format(
+ ACCOUNT_ID
+ ),
}
]
)
diff --git a/tests/test_iam/test_iam.py b/tests/test_iam/test_iam.py
index 81a0b5a34..6311dce9c 100644
--- a/tests/test_iam/test_iam.py
+++ b/tests/test_iam/test_iam.py
@@ -84,7 +84,9 @@ def test_get_all_server_certs():
certs.should.have.length_of(1)
cert1 = certs[0]
cert1.server_certificate_name.should.equal("certname")
- cert1.arn.should.equal("arn:aws:iam::{}:server-certificate/certname".format(ACCOUNT_ID))
+ cert1.arn.should.equal(
+ "arn:aws:iam::{}:server-certificate/certname".format(ACCOUNT_ID)
+ )
@mock_iam_deprecated()
@@ -102,7 +104,9 @@ def test_get_server_cert():
conn.upload_server_cert("certname", "certbody", "privatekey")
cert = conn.get_server_certificate("certname")
cert.server_certificate_name.should.equal("certname")
- cert.arn.should.equal("arn:aws:iam::{}:server-certificate/certname".format(ACCOUNT_ID))
+ cert.arn.should.equal(
+ "arn:aws:iam::{}:server-certificate/certname".format(ACCOUNT_ID)
+ )
@mock_iam_deprecated()
@@ -112,7 +116,9 @@ def test_upload_server_cert():
conn.upload_server_cert("certname", "certbody", "privatekey")
cert = conn.get_server_certificate("certname")
cert.server_certificate_name.should.equal("certname")
- cert.arn.should.equal("arn:aws:iam::{}:server-certificate/certname".format(ACCOUNT_ID))
+ cert.arn.should.equal(
+ "arn:aws:iam::{}:server-certificate/certname".format(ACCOUNT_ID)
+ )
@mock_iam_deprecated()
@@ -443,7 +449,9 @@ def test_create_policy_versions():
conn = boto3.client("iam", region_name="us-east-1")
with assert_raises(ClientError):
conn.create_policy_version(
- PolicyArn="arn:aws:iam::{}:policy/TestCreatePolicyVersion".format(ACCOUNT_ID),
+ PolicyArn="arn:aws:iam::{}:policy/TestCreatePolicyVersion".format(
+ ACCOUNT_ID
+ ),
PolicyDocument='{"some":"policy"}',
)
conn.create_policy(PolicyName="TestCreatePolicyVersion", PolicyDocument=MOCK_POLICY)
@@ -475,12 +483,16 @@ def test_create_many_policy_versions():
)
for _ in range(0, 4):
conn.create_policy_version(
- PolicyArn="arn:aws:iam::{}:policy/TestCreateManyPolicyVersions".format(ACCOUNT_ID),
+ PolicyArn="arn:aws:iam::{}:policy/TestCreateManyPolicyVersions".format(
+ ACCOUNT_ID
+ ),
PolicyDocument=MOCK_POLICY,
)
with assert_raises(ClientError):
conn.create_policy_version(
- PolicyArn="arn:aws:iam::{}:policy/TestCreateManyPolicyVersions".format(ACCOUNT_ID),
+ PolicyArn="arn:aws:iam::{}:policy/TestCreateManyPolicyVersions".format(
+ ACCOUNT_ID
+ ),
PolicyDocument=MOCK_POLICY,
)
@@ -492,17 +504,23 @@ def test_set_default_policy_version():
PolicyName="TestSetDefaultPolicyVersion", PolicyDocument=MOCK_POLICY
)
conn.create_policy_version(
- PolicyArn="arn:aws:iam::{}:policy/TestSetDefaultPolicyVersion".format(ACCOUNT_ID),
+ PolicyArn="arn:aws:iam::{}:policy/TestSetDefaultPolicyVersion".format(
+ ACCOUNT_ID
+ ),
PolicyDocument=MOCK_POLICY_2,
SetAsDefault=True,
)
conn.create_policy_version(
- PolicyArn="arn:aws:iam::{}:policy/TestSetDefaultPolicyVersion".format(ACCOUNT_ID),
+ PolicyArn="arn:aws:iam::{}:policy/TestSetDefaultPolicyVersion".format(
+ ACCOUNT_ID
+ ),
PolicyDocument=MOCK_POLICY_3,
SetAsDefault=True,
)
versions = conn.list_policy_versions(
- PolicyArn="arn:aws:iam::{}:policy/TestSetDefaultPolicyVersion".format(ACCOUNT_ID)
+ PolicyArn="arn:aws:iam::{}:policy/TestSetDefaultPolicyVersion".format(
+ ACCOUNT_ID
+ )
)
versions.get("Versions")[0].get("Document").should.equal(json.loads(MOCK_POLICY))
versions.get("Versions")[0].get("IsDefaultVersion").shouldnt.be.ok
@@ -518,7 +536,9 @@ def test_get_policy():
response = conn.create_policy(
PolicyName="TestGetPolicy", PolicyDocument=MOCK_POLICY
)
- policy = conn.get_policy(PolicyArn="arn:aws:iam::{}:policy/TestGetPolicy".format(ACCOUNT_ID))
+ policy = conn.get_policy(
+ PolicyArn="arn:aws:iam::{}:policy/TestGetPolicy".format(ACCOUNT_ID)
+ )
policy["Policy"]["Arn"].should.equal(
"arn:aws:iam::{}:policy/TestGetPolicy".format(ACCOUNT_ID)
)
@@ -638,7 +658,9 @@ def test_delete_policy_version():
)
with assert_raises(ClientError):
conn.delete_policy_version(
- PolicyArn="arn:aws:iam::{}:policy/TestDeletePolicyVersion".format(ACCOUNT_ID),
+ PolicyArn="arn:aws:iam::{}:policy/TestDeletePolicyVersion".format(
+ ACCOUNT_ID
+ ),
VersionId="v2-nope-this-does-not-exist",
)
conn.delete_policy_version(
@@ -661,7 +683,9 @@ def test_delete_default_policy_version():
)
with assert_raises(ClientError):
conn.delete_policy_version(
- PolicyArn="arn:aws:iam::{}:policy/TestDeletePolicyVersion".format(ACCOUNT_ID),
+ PolicyArn="arn:aws:iam::{}:policy/TestDeletePolicyVersion".format(
+ ACCOUNT_ID
+ ),
VersionId="v1",
)
@@ -840,7 +864,9 @@ def test_create_virtual_mfa_device():
response = client.create_virtual_mfa_device(VirtualMFADeviceName="test-device")
device = response["VirtualMFADevice"]
- device["SerialNumber"].should.equal("arn:aws:iam::{}:mfa/test-device".format(ACCOUNT_ID))
+ device["SerialNumber"].should.equal(
+ "arn:aws:iam::{}:mfa/test-device".format(ACCOUNT_ID)
+ )
device["Base32StringSeed"].decode("ascii").should.match("[A-Z234567]")
device["QRCodePNG"].should_not.be.empty
@@ -849,7 +875,9 @@ def test_create_virtual_mfa_device():
)
device = response["VirtualMFADevice"]
- device["SerialNumber"].should.equal("arn:aws:iam::{}:mfa/test-device-2".format(ACCOUNT_ID))
+ device["SerialNumber"].should.equal(
+ "arn:aws:iam::{}:mfa/test-device-2".format(ACCOUNT_ID)
+ )
device["Base32StringSeed"].decode("ascii").should.match("[A-Z234567]")
device["QRCodePNG"].should_not.be.empty
@@ -1010,7 +1038,9 @@ def test_enable_virtual_mfa_device():
device["User"]["Path"].should.equal("/")
device["User"]["UserName"].should.equal("test-user")
device["User"]["UserId"].should_not.be.empty
- device["User"]["Arn"].should.equal("arn:aws:iam::{}:user/test-user".format(ACCOUNT_ID))
+ device["User"]["Arn"].should.equal(
+ "arn:aws:iam::{}:user/test-user".format(ACCOUNT_ID)
+ )
device["User"]["CreateDate"].should.be.a(datetime)
device["EnableDate"].should.be.a(datetime)
response["IsTruncated"].should_not.be.ok
@@ -1471,10 +1501,12 @@ def test_get_account_authorization_details():
)
conn.attach_user_policy(
- UserName="testUser", PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
+ UserName="testUser",
+ PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID),
)
conn.attach_group_policy(
- GroupName="testGroup", PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
+ GroupName="testGroup",
+ PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID),
)
conn.add_user_to_group(UserName="testUser", GroupName="testGroup")
@@ -1493,7 +1525,8 @@ def test_get_account_authorization_details():
RoleName="my-role", PolicyName="test-policy", PolicyDocument=test_policy
)
conn.attach_role_policy(
- RoleName="my-role", PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
+ RoleName="my-role",
+ PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID),
)
result = conn.get_account_authorization_details(Filter=["Role"])
@@ -1519,10 +1552,9 @@ def test_get_account_authorization_details():
result["RoleDetailList"][0]["AttachedManagedPolicies"][0]["PolicyName"]
== "testPolicy"
)
- assert (
- result["RoleDetailList"][0]["AttachedManagedPolicies"][0]["PolicyArn"]
- == "arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
- )
+ assert result["RoleDetailList"][0]["AttachedManagedPolicies"][0][
+ "PolicyArn"
+ ] == "arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
result = conn.get_account_authorization_details(Filter=["User"])
assert len(result["RoleDetailList"]) == 0
@@ -1535,10 +1567,9 @@ def test_get_account_authorization_details():
result["UserDetailList"][0]["AttachedManagedPolicies"][0]["PolicyName"]
== "testPolicy"
)
- assert (
- result["UserDetailList"][0]["AttachedManagedPolicies"][0]["PolicyArn"]
- == "arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
- )
+ assert result["UserDetailList"][0]["AttachedManagedPolicies"][0][
+ "PolicyArn"
+ ] == "arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
result = conn.get_account_authorization_details(Filter=["Group"])
assert len(result["RoleDetailList"]) == 0
@@ -1551,10 +1582,9 @@ def test_get_account_authorization_details():
result["GroupDetailList"][0]["AttachedManagedPolicies"][0]["PolicyName"]
== "testPolicy"
)
- assert (
- result["GroupDetailList"][0]["AttachedManagedPolicies"][0]["PolicyArn"]
- == "arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
- )
+ assert result["GroupDetailList"][0]["AttachedManagedPolicies"][0][
+ "PolicyArn"
+ ] == "arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
result = conn.get_account_authorization_details(Filter=["LocalManagedPolicy"])
assert len(result["RoleDetailList"]) == 0
@@ -2115,10 +2145,12 @@ def test_list_entities_for_policy():
)
conn.attach_user_policy(
- UserName="testUser", PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
+ UserName="testUser",
+ PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID),
)
conn.attach_group_policy(
- GroupName="testGroup", PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
+ GroupName="testGroup",
+ PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID),
)
conn.add_user_to_group(UserName="testUser", GroupName="testGroup")
@@ -2137,21 +2169,25 @@ def test_list_entities_for_policy():
RoleName="my-role", PolicyName="test-policy", PolicyDocument=test_policy
)
conn.attach_role_policy(
- RoleName="my-role", PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID)
+ RoleName="my-role",
+ PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID),
)
response = conn.list_entities_for_policy(
- PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID), EntityFilter="Role"
+ PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID),
+ EntityFilter="Role",
)
assert response["PolicyRoles"] == [{"RoleName": "my-role"}]
response = conn.list_entities_for_policy(
- PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID), EntityFilter="User"
+ PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID),
+ EntityFilter="User",
)
assert response["PolicyUsers"] == [{"UserName": "testUser"}]
response = conn.list_entities_for_policy(
- PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID), EntityFilter="Group"
+ PolicyArn="arn:aws:iam::{}:policy/testPolicy".format(ACCOUNT_ID),
+ EntityFilter="Group",
)
assert response["PolicyGroups"] == [{"GroupName": "testGroup"}]
@@ -2170,7 +2206,9 @@ def test_create_role_no_path():
resp = conn.create_role(
RoleName="my-role", AssumeRolePolicyDocument="some policy", Description="test"
)
- resp.get("Role").get("Arn").should.equal("arn:aws:iam::{}:role/my-role".format(ACCOUNT_ID))
+ resp.get("Role").get("Arn").should.equal(
+ "arn:aws:iam::{}:role/my-role".format(ACCOUNT_ID)
+ )
resp.get("Role").should_not.have.key("PermissionsBoundary")
resp.get("Role").get("Description").should.equal("test")
diff --git a/tests/test_iam/test_iam_groups.py b/tests/test_iam/test_iam_groups.py
index dba331bb9..64d838e2b 100644
--- a/tests/test_iam/test_iam_groups.py
+++ b/tests/test_iam/test_iam_groups.py
@@ -58,10 +58,9 @@ def test_get_group_current():
# Make a group with a different path:
other_group = conn.create_group(GroupName="my-other-group", Path="some/location")
assert other_group["Group"]["Path"] == "some/location"
- assert (
- other_group["Group"]["Arn"]
- == "arn:aws:iam::{}:group/some/location/my-other-group".format(ACCOUNT_ID)
- )
+ assert other_group["Group"][
+ "Arn"
+ ] == "arn:aws:iam::{}:group/some/location/my-other-group".format(ACCOUNT_ID)
@mock_iam_deprecated()
diff --git a/tests/test_kinesis/test_firehose.py b/tests/test_kinesis/test_firehose.py
index 7ec84bb10..5e8c4aa08 100644
--- a/tests/test_kinesis/test_firehose.py
+++ b/tests/test_kinesis/test_firehose.py
@@ -27,7 +27,9 @@ def create_s3_delivery_stream(client, stream_name):
},
"SchemaConfiguration": {
"DatabaseName": stream_name,
- "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(ACCOUNT_ID),
+ "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(
+ ACCOUNT_ID
+ ),
"TableName": "outputTable",
},
},
@@ -48,7 +50,9 @@ def create_redshift_delivery_stream(client, stream_name):
"Username": "username",
"Password": "password",
"S3Configuration": {
- "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(ACCOUNT_ID),
+ "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(
+ ACCOUNT_ID
+ ),
"BucketARN": "arn:aws:s3:::kinesis-test",
"Prefix": "myFolder/",
"BufferingHints": {"SizeInMBs": 123, "IntervalInSeconds": 124},
@@ -82,7 +86,9 @@ def test_create_redshift_delivery_stream():
{
"DestinationId": "string",
"RedshiftDestinationDescription": {
- "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(ACCOUNT_ID),
+ "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(
+ ACCOUNT_ID
+ ),
"ClusterJDBCURL": "jdbc:redshift://host.amazonaws.com:5439/database",
"CopyCommand": {
"DataTableName": "outputTable",
@@ -90,7 +96,9 @@ def test_create_redshift_delivery_stream():
},
"Username": "username",
"S3DestinationDescription": {
- "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(ACCOUNT_ID),
+ "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(
+ ACCOUNT_ID
+ ),
"BucketARN": "arn:aws:s3:::kinesis-test",
"Prefix": "myFolder/",
"BufferingHints": {
@@ -131,7 +139,9 @@ def test_create_s3_delivery_stream():
{
"DestinationId": "string",
"ExtendedS3DestinationDescription": {
- "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(ACCOUNT_ID),
+ "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(
+ ACCOUNT_ID
+ ),
"BucketARN": "arn:aws:s3:::kinesis-test",
"Prefix": "myFolder/",
"CompressionFormat": "UNCOMPRESSED",
@@ -147,7 +157,9 @@ def test_create_s3_delivery_stream():
},
"SchemaConfiguration": {
"DatabaseName": "stream1",
- "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(ACCOUNT_ID),
+ "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(
+ ACCOUNT_ID
+ ),
"TableName": "outputTable",
},
},
@@ -192,8 +204,12 @@ def test_create_stream_without_redshift():
{
"DestinationId": "string",
"S3DestinationDescription": {
- "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(ACCOUNT_ID),
- "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(ACCOUNT_ID),
+ "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(
+ ACCOUNT_ID
+ ),
+ "RoleARN": "arn:aws:iam::{}:role/firehose_delivery_role".format(
+ ACCOUNT_ID
+ ),
"BucketARN": "arn:aws:s3:::kinesis-test",
"Prefix": "myFolder/",
"BufferingHints": {"SizeInMBs": 123, "IntervalInSeconds": 124},
diff --git a/tests/test_kinesis/test_kinesis.py b/tests/test_kinesis/test_kinesis.py
index 8ae83484b..de1764892 100644
--- a/tests/test_kinesis/test_kinesis.py
+++ b/tests/test_kinesis/test_kinesis.py
@@ -22,7 +22,9 @@ def test_create_cluster():
stream = stream_response["StreamDescription"]
stream["StreamName"].should.equal("my_stream")
stream["HasMoreShards"].should.equal(False)
- stream["StreamARN"].should.equal("arn:aws:kinesis:us-west-2:{}:my_stream".format(ACCOUNT_ID))
+ stream["StreamARN"].should.equal(
+ "arn:aws:kinesis:us-west-2:{}:my_stream".format(ACCOUNT_ID)
+ )
stream["StreamStatus"].should.equal("ACTIVE")
shards = stream["Shards"]
diff --git a/tests/test_redshift/test_redshift.py b/tests/test_redshift/test_redshift.py
index aeb04e6a0..6bb3b1396 100644
--- a/tests/test_redshift/test_redshift.py
+++ b/tests/test_redshift/test_redshift.py
@@ -20,6 +20,7 @@ from moto import mock_redshift
from moto import mock_redshift_deprecated
from moto.core import ACCOUNT_ID
+
@mock_redshift
def test_create_cluster_boto3():
client = boto3.client("redshift", region_name="us-east-1")
@@ -1044,7 +1045,9 @@ def test_describe_tags_with_resource_type():
@mock_redshift
def test_describe_tags_cannot_specify_resource_type_and_resource_name():
client = boto3.client("redshift", region_name="us-east-1")
- resource_name = "arn:aws:redshift:us-east-1:{}:cluster:cluster-id".format(ACCOUNT_ID)
+ resource_name = "arn:aws:redshift:us-east-1:{}:cluster:cluster-id".format(
+ ACCOUNT_ID
+ )
resource_type = "cluster"
client.describe_tags.when.called_with(
ResourceName=resource_name, ResourceType=resource_type
diff --git a/tests/test_sns/test_publishing.py b/tests/test_sns/test_publishing.py
index 80e61f625..30fa80f15 100644
--- a/tests/test_sns/test_publishing.py
+++ b/tests/test_sns/test_publishing.py
@@ -9,7 +9,13 @@ import sure # noqa
from moto import mock_sns_deprecated, mock_sqs_deprecated
from moto.core import ACCOUNT_ID
-MESSAGE_FROM_SQS_TEMPLATE = '{\n "Message": "%s",\n "MessageId": "%s",\n "Signature": "EXAMPLElDMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn/49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7NFhUzLiieYr4BKHpdTmdD6c0esKEYBpabxDSc=",\n "SignatureVersion": "1",\n "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",\n "Subject": "%s",\n "Timestamp": "2015-01-01T12:00:00.000Z",\n "TopicArn": "arn:aws:sns:%s:'+ACCOUNT_ID+':some-topic",\n "Type": "Notification",\n "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:'+ACCOUNT_ID+':some-topic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55"\n}'
+MESSAGE_FROM_SQS_TEMPLATE = (
+ '{\n "Message": "%s",\n "MessageId": "%s",\n "Signature": "EXAMPLElDMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn/49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7NFhUzLiieYr4BKHpdTmdD6c0esKEYBpabxDSc=",\n "SignatureVersion": "1",\n "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",\n "Subject": "%s",\n "Timestamp": "2015-01-01T12:00:00.000Z",\n "TopicArn": "arn:aws:sns:%s:'
+ + ACCOUNT_ID
+ + ':some-topic",\n "Type": "Notification",\n "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:'
+ + ACCOUNT_ID
+ + ':some-topic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55"\n}'
+)
@mock_sqs_deprecated
@@ -25,7 +31,9 @@ def test_publish_to_sqs():
sqs_conn = boto.connect_sqs()
sqs_conn.create_queue("test-queue")
- conn.subscribe(topic_arn, "sqs", "arn:aws:sqs:us-east-1:{}:test-queue".format(ACCOUNT_ID))
+ conn.subscribe(
+ topic_arn, "sqs", "arn:aws:sqs:us-east-1:{}:test-queue".format(ACCOUNT_ID)
+ )
message_to_publish = "my message"
subject_to_publish = "test subject"
@@ -66,7 +74,9 @@ def test_publish_to_sqs_in_different_region():
sqs_conn = boto.sqs.connect_to_region("us-west-2")
sqs_conn.create_queue("test-queue")
- conn.subscribe(topic_arn, "sqs", "arn:aws:sqs:us-west-2:{}:test-queue".format(ACCOUNT_ID))
+ conn.subscribe(
+ topic_arn, "sqs", "arn:aws:sqs:us-west-2:{}:test-queue".format(ACCOUNT_ID)
+ )
message_to_publish = "my message"
subject_to_publish = "test subject"
diff --git a/tests/test_sns/test_publishing_boto3.py b/tests/test_sns/test_publishing_boto3.py
index c84af9ade..d85c8fefe 100644
--- a/tests/test_sns/test_publishing_boto3.py
+++ b/tests/test_sns/test_publishing_boto3.py
@@ -14,7 +14,13 @@ from nose.tools import assert_raises
from moto import mock_sns, mock_sqs
from moto.core import ACCOUNT_ID
-MESSAGE_FROM_SQS_TEMPLATE = '{\n "Message": "%s",\n "MessageId": "%s",\n "Signature": "EXAMPLElDMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn/49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7NFhUzLiieYr4BKHpdTmdD6c0esKEYBpabxDSc=",\n "SignatureVersion": "1",\n "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",\n "Subject": "my subject",\n "Timestamp": "2015-01-01T12:00:00.000Z",\n "TopicArn": "arn:aws:sns:%s:'+ACCOUNT_ID+':some-topic",\n "Type": "Notification",\n "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:'+ACCOUNT_ID+':some-topic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55"\n}'
+MESSAGE_FROM_SQS_TEMPLATE = (
+ '{\n "Message": "%s",\n "MessageId": "%s",\n "Signature": "EXAMPLElDMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn/49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7NFhUzLiieYr4BKHpdTmdD6c0esKEYBpabxDSc=",\n "SignatureVersion": "1",\n "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem",\n "Subject": "my subject",\n "Timestamp": "2015-01-01T12:00:00.000Z",\n "TopicArn": "arn:aws:sns:%s:'
+ + ACCOUNT_ID
+ + ':some-topic",\n "Type": "Notification",\n "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:'
+ + ACCOUNT_ID
+ + ':some-topic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55"\n}'
+)
@mock_sqs
diff --git a/tests/test_sns/test_topics.py b/tests/test_sns/test_topics.py
index 57bef29f0..e91ab6e2d 100644
--- a/tests/test_sns/test_topics.py
+++ b/tests/test_sns/test_topics.py
@@ -59,7 +59,9 @@ def test_topic_corresponds_to_region():
topic_arn = topics_json["ListTopicsResponse"]["ListTopicsResult"]["Topics"][0][
"TopicArn"
]
- topic_arn.should.equal("arn:aws:sns:{0}:{1}:some-topic".format(region, ACCOUNT_ID))
+ topic_arn.should.equal(
+ "arn:aws:sns:{0}:{1}:some-topic".format(region, ACCOUNT_ID)
+ )
@mock_sns_deprecated
@@ -99,7 +101,9 @@ def test_topic_attributes():
"SNS:Publish",
"SNS:Receive",
],
- "Resource": "arn:aws:sns:us-east-1:{}:some-topic".format(ACCOUNT_ID),
+ "Resource": "arn:aws:sns:us-east-1:{}:some-topic".format(
+ ACCOUNT_ID
+ ),
"Condition": {"StringEquals": {"AWS:SourceOwner": ACCOUNT_ID}},
}
],
diff --git a/tests/test_sns/test_topics_boto3.py b/tests/test_sns/test_topics_boto3.py
index d06dafcb6..87800bd84 100644
--- a/tests/test_sns/test_topics_boto3.py
+++ b/tests/test_sns/test_topics_boto3.py
@@ -10,6 +10,7 @@ from moto import mock_sns
from moto.sns.models import DEFAULT_EFFECTIVE_DELIVERY_POLICY, DEFAULT_PAGE_SIZE
from moto.core import ACCOUNT_ID
+
@mock_sns
def test_create_and_delete_topic():
conn = boto3.client("sns", region_name="us-east-1")
@@ -132,7 +133,9 @@ def test_topic_corresponds_to_region():
conn.create_topic(Name="some-topic")
topics_json = conn.list_topics()
topic_arn = topics_json["Topics"][0]["TopicArn"]
- topic_arn.should.equal("arn:aws:sns:{0}:{1}:some-topic".format(region, ACCOUNT_ID))
+ topic_arn.should.equal(
+ "arn:aws:sns:{0}:{1}:some-topic".format(region, ACCOUNT_ID)
+ )
@mock_sns
@@ -170,7 +173,9 @@ def test_topic_attributes():
"SNS:Publish",
"SNS:Receive",
],
- "Resource": "arn:aws:sns:us-east-1:{}:some-topic".format(ACCOUNT_ID),
+ "Resource": "arn:aws:sns:us-east-1:{}:some-topic".format(
+ ACCOUNT_ID
+ ),
"Condition": {"StringEquals": {"AWS:SourceOwner": ACCOUNT_ID}},
}
],
@@ -271,7 +276,9 @@ def test_add_remove_permissions():
"SNS:Publish",
"SNS:Receive",
],
- "Resource": "arn:aws:sns:us-east-1:{}:test-permissions".format(ACCOUNT_ID),
+ "Resource": "arn:aws:sns:us-east-1:{}:test-permissions".format(
+ ACCOUNT_ID
+ ),
"Condition": {"StringEquals": {"AWS:SourceOwner": ACCOUNT_ID}},
},
{
@@ -279,7 +286,9 @@ def test_add_remove_permissions():
"Effect": "Allow",
"Principal": {"AWS": "arn:aws:iam::999999999999:root"},
"Action": "SNS:Publish",
- "Resource": "arn:aws:sns:us-east-1:{}:test-permissions".format(ACCOUNT_ID),
+ "Resource": "arn:aws:sns:us-east-1:{}:test-permissions".format(
+ ACCOUNT_ID
+ ),
},
],
}
@@ -308,7 +317,9 @@ def test_add_remove_permissions():
"SNS:Publish",
"SNS:Receive",
],
- "Resource": "arn:aws:sns:us-east-1:{}:test-permissions".format(ACCOUNT_ID),
+ "Resource": "arn:aws:sns:us-east-1:{}:test-permissions".format(
+ ACCOUNT_ID
+ ),
"Condition": {"StringEquals": {"AWS:SourceOwner": ACCOUNT_ID}},
}
],
diff --git a/tests/test_sqs/test_sqs.py b/tests/test_sqs/test_sqs.py
index 0f900f4c2..639d6e51c 100644
--- a/tests/test_sqs/test_sqs.py
+++ b/tests/test_sqs/test_sqs.py
@@ -23,6 +23,7 @@ from nose.tools import assert_raises
from tests.helpers import requires_boto_gte
from moto.core import ACCOUNT_ID
+
@mock_sqs
def test_create_fifo_queue_fail():
sqs = boto3.client("sqs", region_name="us-east-1")
@@ -283,7 +284,7 @@ def test_create_queues_in_multiple_region():
base_url = "https://us-west-1.queue.amazonaws.com"
west1_conn.list_queues()["QueueUrls"][0].should.equal(
- "{base_url}/{AccountId}/blah".format(base_url=base_url,AccountId=ACCOUNT_ID)
+ "{base_url}/{AccountId}/blah".format(base_url=base_url, AccountId=ACCOUNT_ID)
)
@@ -305,7 +306,9 @@ def test_get_queue_with_prefix():
base_url = "https://us-west-1.queue.amazonaws.com"
queue[0].should.equal(
- "{base_url}/{AccountId}/test-queue".format(base_url=base_url, AccountId=ACCOUNT_ID)
+ "{base_url}/{AccountId}/test-queue".format(
+ base_url=base_url, AccountId=ACCOUNT_ID
+ )
)
@@ -851,7 +854,9 @@ def test_queue_attributes():
attributes = queue.get_attributes()
attributes["QueueArn"].should.look_like(
- "arn:aws:sqs:us-east-1:{AccountId}:{name}".format(AccountId=ACCOUNT_ID,name=queue_name)
+ "arn:aws:sqs:us-east-1:{AccountId}:{name}".format(
+ AccountId=ACCOUNT_ID, name=queue_name
+ )
)
attributes["VisibilityTimeout"].should.look_like(str(visibility_timeout))
diff --git a/tests/test_stepfunctions/test_stepfunctions.py b/tests/test_stepfunctions/test_stepfunctions.py
index 5c4ba97ae..3e0a8115d 100644
--- a/tests/test_stepfunctions/test_stepfunctions.py
+++ b/tests/test_stepfunctions/test_stepfunctions.py
@@ -34,7 +34,7 @@ def test_state_machine_creation_succeeds():
response["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
response["creationDate"].should.be.a(datetime)
response["stateMachineArn"].should.equal(
- "arn:aws:states:" + region + ":"+ACCOUNT_ID+":stateMachine:" + name
+ "arn:aws:states:" + region + ":" + ACCOUNT_ID + ":stateMachine:" + name
)
@@ -286,7 +286,7 @@ def test_state_machine_can_deleted_nonexisting_machine():
client = boto3.client("stepfunctions", region_name=region)
#
unknown_state_machine = (
- "arn:aws:states:" + region + ":"+ACCOUNT_ID+":stateMachine:unknown"
+ "arn:aws:states:" + region + ":" + ACCOUNT_ID + ":stateMachine:unknown"
)
response = client.delete_state_machine(stateMachineArn=unknown_state_machine)
response["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)