black linting
This commit is contained in:
parent
fd9ac4b9a5
commit
743dd46399
@ -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 = """<StopStackSetOperationResponse x
|
||||
</ResponseMetadata> </StopStackSetOperationResponse>
|
||||
"""
|
||||
|
||||
DESCRIBE_STACKSET_OPERATION_RESPONSE_TEMPLATE = """<DescribeStackSetOperationResponse xmlns="http://internal.amazon.com/coral/com.amazonaws.maestro.service.v20160713/">
|
||||
DESCRIBE_STACKSET_OPERATION_RESPONSE_TEMPLATE = (
|
||||
"""<DescribeStackSetOperationResponse xmlns="http://internal.amazon.com/coral/com.amazonaws.maestro.service.v20160713/">
|
||||
<DescribeStackSetOperationResult>
|
||||
<StackSetOperation>
|
||||
<ExecutionRoleName>{{ stackset.execution_role }}</ExecutionRoleName>
|
||||
<AdministrationRoleARN>arn:aws:iam::""" + ACCOUNT_ID + """:role/{{ stackset.admin_role }}</AdministrationRoleARN>
|
||||
<AdministrationRoleARN>arn:aws:iam::"""
|
||||
+ ACCOUNT_ID
|
||||
+ """:role/{{ stackset.admin_role }}</AdministrationRoleARN>
|
||||
<StackSetId>{{ stackset.id }}</StackSetId>
|
||||
<CreationTimestamp>{{ operation.CreationTimestamp }}</CreationTimestamp>
|
||||
<OperationId>{{ operation.OperationId }}</OperationId>
|
||||
@ -1073,15 +1078,19 @@ DESCRIBE_STACKSET_OPERATION_RESPONSE_TEMPLATE = """<DescribeStackSetOperationRes
|
||||
</ResponseMetadata>
|
||||
</DescribeStackSetOperationResponse>
|
||||
"""
|
||||
)
|
||||
|
||||
LIST_STACK_SET_OPERATION_RESULTS_RESPONSE_TEMPLATE = """<ListStackSetOperationResultsResponse xmlns="http://internal.amazon.com/coral/com.amazonaws.maestro.service.v20160713/">
|
||||
LIST_STACK_SET_OPERATION_RESULTS_RESPONSE_TEMPLATE = (
|
||||
"""<ListStackSetOperationResultsResponse xmlns="http://internal.amazon.com/coral/com.amazonaws.maestro.service.v20160713/">
|
||||
<ListStackSetOperationResultsResult>
|
||||
<Summaries>
|
||||
{% for instance in operation.Instances %}
|
||||
{% for account, region in instance.items() %}
|
||||
<member>
|
||||
<AccountGateResult>
|
||||
<StatusReason>Function not found: arn:aws:lambda:us-west-2:""" + ACCOUNT_ID + """:function:AWSCloudFormationStackSetAccountGate</StatusReason>
|
||||
<StatusReason>Function not found: arn:aws:lambda:us-west-2:"""
|
||||
+ ACCOUNT_ID
|
||||
+ """:function:AWSCloudFormationStackSetAccountGate</StatusReason>
|
||||
<Status>SKIPPED</Status>
|
||||
</AccountGateResult>
|
||||
<Region>{{ region }}</Region>
|
||||
@ -1097,3 +1106,4 @@ LIST_STACK_SET_OPERATION_RESULTS_RESPONSE_TEMPLATE = """<ListStackSetOperationRe
|
||||
</ResponseMetadata>
|
||||
</ListStackSetOperationResultsResponse>
|
||||
"""
|
||||
)
|
||||
|
@ -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(
|
||||
|
@ -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",
|
||||
|
@ -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 (
|
||||
|
@ -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
|
||||
|
@ -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 = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||
EC2_RUN_INSTANCES = (
|
||||
"""<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||
<requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
|
||||
<reservationId>{{ reservation.id }}</reservationId>
|
||||
<ownerId>""" + ACCOUNT_ID + """</ownerId>
|
||||
<ownerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ownerId>
|
||||
<groupSet>
|
||||
<item>
|
||||
<groupId>sg-245f6a01</groupId>
|
||||
@ -331,7 +335,9 @@ EC2_RUN_INSTANCES = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc
|
||||
<vpcId>{{ nic.subnet.vpc_id }}</vpcId>
|
||||
{% endif %}
|
||||
<description>Primary network interface</description>
|
||||
<ownerId>""" + ACCOUNT_ID + """</ownerId>
|
||||
<ownerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ownerId>
|
||||
<status>in-use</status>
|
||||
<macAddress>1b:2b:3c:4d:5e:6f</macAddress>
|
||||
<privateIpAddress>{{ nic.private_ip_address }}</privateIpAddress>
|
||||
@ -354,7 +360,9 @@ EC2_RUN_INSTANCES = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc
|
||||
{% if nic.public_ip %}
|
||||
<association>
|
||||
<publicIp>{{ nic.public_ip }}</publicIp>
|
||||
<ipOwnerId>""" + ACCOUNT_ID + """</ipOwnerId>
|
||||
<ipOwnerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ipOwnerId>
|
||||
</association>
|
||||
{% endif %}
|
||||
<privateIpAddressesSet>
|
||||
@ -364,7 +372,9 @@ EC2_RUN_INSTANCES = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc
|
||||
{% if nic.public_ip %}
|
||||
<association>
|
||||
<publicIp>{{ nic.public_ip }}</publicIp>
|
||||
<ipOwnerId>""" + ACCOUNT_ID + """</ipOwnerId>
|
||||
<ipOwnerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ipOwnerId>
|
||||
</association>
|
||||
{% endif %}
|
||||
</item>
|
||||
@ -376,14 +386,18 @@ EC2_RUN_INSTANCES = """<RunInstancesResponse xmlns="http://ec2.amazonaws.com/doc
|
||||
{% endfor %}
|
||||
</instancesSet>
|
||||
</RunInstancesResponse>"""
|
||||
)
|
||||
|
||||
EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||
EC2_DESCRIBE_INSTANCES = (
|
||||
"""<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||
<requestId>fdcdcab1-ae5c-489e-9c33-4637c5dda355</requestId>
|
||||
<reservationSet>
|
||||
{% for reservation in reservations %}
|
||||
<item>
|
||||
<reservationId>{{ reservation.id }}</reservationId>
|
||||
<ownerId>""" + ACCOUNT_ID + """</ownerId>
|
||||
<ownerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ownerId>
|
||||
<groupSet>
|
||||
{% for group in reservation.dynamic_group_list %}
|
||||
<item>
|
||||
@ -476,7 +490,9 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazona
|
||||
{% endfor %}
|
||||
</blockDeviceMapping>
|
||||
<virtualizationType>{{ instance.virtualization_type }}</virtualizationType>
|
||||
<clientToken>ABCDE""" + ACCOUNT_ID + """3</clientToken>
|
||||
<clientToken>ABCDE"""
|
||||
+ ACCOUNT_ID
|
||||
+ """3</clientToken>
|
||||
{% if instance.get_tags() %}
|
||||
<tagSet>
|
||||
{% for tag in instance.get_tags() %}
|
||||
@ -499,7 +515,9 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazona
|
||||
<vpcId>{{ nic.subnet.vpc_id }}</vpcId>
|
||||
{% endif %}
|
||||
<description>Primary network interface</description>
|
||||
<ownerId>""" + ACCOUNT_ID + """</ownerId>
|
||||
<ownerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ownerId>
|
||||
<status>in-use</status>
|
||||
<macAddress>1b:2b:3c:4d:5e:6f</macAddress>
|
||||
<privateIpAddress>{{ nic.private_ip_address }}</privateIpAddress>
|
||||
@ -526,7 +544,9 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazona
|
||||
{% if nic.public_ip %}
|
||||
<association>
|
||||
<publicIp>{{ nic.public_ip }}</publicIp>
|
||||
<ipOwnerId>""" + ACCOUNT_ID + """</ipOwnerId>
|
||||
<ipOwnerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ipOwnerId>
|
||||
</association>
|
||||
{% endif %}
|
||||
<privateIpAddressesSet>
|
||||
@ -536,7 +556,9 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazona
|
||||
{% if nic.public_ip %}
|
||||
<association>
|
||||
<publicIp>{{ nic.public_ip }}</publicIp>
|
||||
<ipOwnerId>""" + ACCOUNT_ID + """</ipOwnerId>
|
||||
<ipOwnerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ipOwnerId>
|
||||
</association>
|
||||
{% endif %}
|
||||
</item>
|
||||
@ -554,6 +576,7 @@ EC2_DESCRIBE_INSTANCES = """<DescribeInstancesResponse xmlns="http://ec2.amazona
|
||||
<nextToken>{{ next_token }}</nextToken>
|
||||
{% endif %}
|
||||
</DescribeInstancesResponse>"""
|
||||
)
|
||||
|
||||
EC2_TERMINATE_INSTANCES = """
|
||||
<TerminateInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||
|
@ -172,12 +172,15 @@ DELETE_GROUP_RESPONSE = """<DeleteSecurityGroupResponse xmlns="http://ec2.amazon
|
||||
<return>true</return>
|
||||
</DeleteSecurityGroupResponse>"""
|
||||
|
||||
DESCRIBE_SECURITY_GROUPS_RESPONSE = """<DescribeSecurityGroupsResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||
DESCRIBE_SECURITY_GROUPS_RESPONSE = (
|
||||
"""<DescribeSecurityGroupsResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||
<requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
|
||||
<securityGroupInfo>
|
||||
{% for group in groups %}
|
||||
<item>
|
||||
<ownerId>""" + ACCOUNT_ID + """</ownerId>
|
||||
<ownerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ownerId>
|
||||
<groupId>{{ group.id }}</groupId>
|
||||
<groupName>{{ group.name }}</groupName>
|
||||
<groupDescription>{{ group.description }}</groupDescription>
|
||||
@ -197,7 +200,9 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """<DescribeSecurityGroupsResponse xmlns="ht
|
||||
<groups>
|
||||
{% for source_group in rule.source_groups %}
|
||||
<item>
|
||||
<userId>""" + ACCOUNT_ID + """</userId>
|
||||
<userId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</userId>
|
||||
<groupId>{{ source_group.id }}</groupId>
|
||||
<groupName>{{ source_group.name }}</groupName>
|
||||
</item>
|
||||
@ -226,7 +231,9 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """<DescribeSecurityGroupsResponse xmlns="ht
|
||||
<groups>
|
||||
{% for source_group in rule.source_groups %}
|
||||
<item>
|
||||
<userId>""" + ACCOUNT_ID + """</userId>
|
||||
<userId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</userId>
|
||||
<groupId>{{ source_group.id }}</groupId>
|
||||
<groupName>{{ source_group.name }}</groupName>
|
||||
</item>
|
||||
@ -256,6 +263,7 @@ DESCRIBE_SECURITY_GROUPS_RESPONSE = """<DescribeSecurityGroupsResponse xmlns="ht
|
||||
{% endfor %}
|
||||
</securityGroupInfo>
|
||||
</DescribeSecurityGroupsResponse>"""
|
||||
)
|
||||
|
||||
AUTHORIZE_SECURITY_GROUP_INGRESS_REPONSE = """<AuthorizeSecurityGroupIngressResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||
<requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
|
||||
|
@ -41,7 +41,8 @@ class VPCPeeringConnections(BaseResponse):
|
||||
return template.render()
|
||||
|
||||
|
||||
CREATE_VPC_PEERING_CONNECTION_RESPONSE = """
|
||||
CREATE_VPC_PEERING_CONNECTION_RESPONSE = (
|
||||
"""
|
||||
<CreateVpcPeeringConnectionResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
|
||||
<requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
|
||||
<vpcPeeringConnection>
|
||||
@ -57,7 +58,9 @@ CREATE_VPC_PEERING_CONNECTION_RESPONSE = """
|
||||
</peeringOptions>
|
||||
</requesterVpcInfo>
|
||||
<accepterVpcInfo>
|
||||
<ownerId>""" + ACCOUNT_ID + """</ownerId>
|
||||
<ownerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ownerId>
|
||||
<vpcId>{{ vpc_pcx.peer_vpc.id }}</vpcId>
|
||||
</accepterVpcInfo>
|
||||
<status>
|
||||
@ -69,8 +72,10 @@ CREATE_VPC_PEERING_CONNECTION_RESPONSE = """
|
||||
</vpcPeeringConnection>
|
||||
</CreateVpcPeeringConnectionResponse>
|
||||
"""
|
||||
)
|
||||
|
||||
DESCRIBE_VPC_PEERING_CONNECTIONS_RESPONSE = """
|
||||
DESCRIBE_VPC_PEERING_CONNECTIONS_RESPONSE = (
|
||||
"""
|
||||
<DescribeVpcPeeringConnectionsResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
|
||||
<requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
|
||||
<vpcPeeringConnectionSet>
|
||||
@ -83,7 +88,9 @@ DESCRIBE_VPC_PEERING_CONNECTIONS_RESPONSE = """
|
||||
<cidrBlock>{{ vpc_pcx.vpc.cidr_block }}</cidrBlock>
|
||||
</requesterVpcInfo>
|
||||
<accepterVpcInfo>
|
||||
<ownerId>""" + ACCOUNT_ID + """</ownerId>
|
||||
<ownerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ownerId>
|
||||
<vpcId>{{ vpc_pcx.peer_vpc.id }}</vpcId>
|
||||
<cidrBlock>{{ vpc_pcx.peer_vpc.cidr_block }}</cidrBlock>
|
||||
<peeringOptions>
|
||||
@ -102,6 +109,7 @@ DESCRIBE_VPC_PEERING_CONNECTIONS_RESPONSE = """
|
||||
</vpcPeeringConnectionSet>
|
||||
</DescribeVpcPeeringConnectionsResponse>
|
||||
"""
|
||||
)
|
||||
|
||||
DELETE_VPC_PEERING_CONNECTION_RESPONSE = """
|
||||
<DeleteVpcPeeringConnectionResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||
@ -110,7 +118,8 @@ DELETE_VPC_PEERING_CONNECTION_RESPONSE = """
|
||||
</DeleteVpcPeeringConnectionResponse>
|
||||
"""
|
||||
|
||||
ACCEPT_VPC_PEERING_CONNECTION_RESPONSE = """
|
||||
ACCEPT_VPC_PEERING_CONNECTION_RESPONSE = (
|
||||
"""
|
||||
<AcceptVpcPeeringConnectionResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
|
||||
<requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
|
||||
<vpcPeeringConnection>
|
||||
@ -121,7 +130,9 @@ ACCEPT_VPC_PEERING_CONNECTION_RESPONSE = """
|
||||
<cidrBlock>{{ vpc_pcx.vpc.cidr_block }}</cidrBlock>
|
||||
</requesterVpcInfo>
|
||||
<accepterVpcInfo>
|
||||
<ownerId>""" + ACCOUNT_ID + """</ownerId>
|
||||
<ownerId>"""
|
||||
+ ACCOUNT_ID
|
||||
+ """</ownerId>
|
||||
<vpcId>{{ vpc_pcx.peer_vpc.id }}</vpcId>
|
||||
<cidrBlock>{{ vpc_pcx.peer_vpc.cidr_block }}</cidrBlock>
|
||||
<peeringOptions>
|
||||
@ -138,6 +149,7 @@ ACCEPT_VPC_PEERING_CONNECTION_RESPONSE = """
|
||||
</vpcPeeringConnection>
|
||||
</AcceptVpcPeeringConnectionResponse>
|
||||
"""
|
||||
)
|
||||
|
||||
REJECT_VPC_PEERING_CONNECTION_RESPONSE = """
|
||||
<RejectVpcPeeringConnectionResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
|
||||
|
@ -1887,7 +1887,8 @@ S3_MULTIPART_COMPLETE_RESPONSE = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
</CompleteMultipartUploadResult>
|
||||
"""
|
||||
|
||||
S3_ALL_MULTIPARTS = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
S3_ALL_MULTIPARTS = (
|
||||
"""<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ListMultipartUploadsResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
||||
<Bucket>{{ bucket_name }}</Bucket>
|
||||
<KeyMarker></KeyMarker>
|
||||
@ -1899,7 +1900,9 @@ S3_ALL_MULTIPARTS = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Key>{{ upload.key_name }}</Key>
|
||||
<UploadId>{{ upload.id }}</UploadId>
|
||||
<Initiator>
|
||||
<ID>arn:aws:iam::""" + ACCOUNT_ID + """:user/user1-11111a31-17b5-4fb7-9df5-b111111f13de</ID>
|
||||
<ID>arn:aws:iam::"""
|
||||
+ ACCOUNT_ID
|
||||
+ """:user/user1-11111a31-17b5-4fb7-9df5-b111111f13de</ID>
|
||||
<DisplayName>user1-11111a31-17b5-4fb7-9df5-b111111f13de</DisplayName>
|
||||
</Initiator>
|
||||
<Owner>
|
||||
@ -1912,6 +1915,7 @@ S3_ALL_MULTIPARTS = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
{% endfor %}
|
||||
</ListMultipartUploadsResult>
|
||||
"""
|
||||
)
|
||||
|
||||
S3_NO_POLICY = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Error>
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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):
|
||||
|
@ -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",
|
||||
|
@ -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],
|
||||
)
|
||||
|
@ -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
|
||||
)
|
||||
|
||||
|
||||
|
@ -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")
|
||||
|
||||
|
||||
|
@ -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",
|
||||
},
|
||||
|
@ -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",
|
||||
|
@ -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)
|
||||
|
@ -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"
|
||||
|
@ -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",
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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",
|
||||
},
|
||||
|
@ -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
|
||||
),
|
||||
}
|
||||
]
|
||||
)
|
||||
|
@ -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")
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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},
|
||||
|
@ -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"]
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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}},
|
||||
}
|
||||
],
|
||||
|
@ -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}},
|
||||
}
|
||||
],
|
||||
|
@ -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))
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user