Added DescribeAccountAttributes
This commit is contained in:
parent
b2b423f833
commit
63b09eae13
@ -1,5 +1,6 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from .account_attributes import AccountAttributes
|
||||||
from .amazon_dev_pay import AmazonDevPay
|
from .amazon_dev_pay import AmazonDevPay
|
||||||
from .amis import AmisResponse
|
from .amis import AmisResponse
|
||||||
from .availability_zones_and_regions import AvailabilityZonesAndRegions
|
from .availability_zones_and_regions import AvailabilityZonesAndRegions
|
||||||
@ -34,6 +35,7 @@ from .nat_gateways import NatGateways
|
|||||||
|
|
||||||
|
|
||||||
class EC2Response(
|
class EC2Response(
|
||||||
|
AccountAttributes,
|
||||||
AmazonDevPay,
|
AmazonDevPay,
|
||||||
AmisResponse,
|
AmisResponse,
|
||||||
AvailabilityZonesAndRegions,
|
AvailabilityZonesAndRegions,
|
||||||
|
69
moto/ec2/responses/account_attributes.py
Normal file
69
moto/ec2/responses/account_attributes.py
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
from moto.core.responses import BaseResponse
|
||||||
|
|
||||||
|
|
||||||
|
class AccountAttributes(BaseResponse):
|
||||||
|
|
||||||
|
def describe_account_attributes(self):
|
||||||
|
template = self.response_template(DESCRIBE_ACCOUNT_ATTRIBUTES_RESULT)
|
||||||
|
return template.render()
|
||||||
|
|
||||||
|
|
||||||
|
DESCRIBE_ACCOUNT_ATTRIBUTES_RESULT = u"""
|
||||||
|
<DescribeAccountAttributesResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
|
||||||
|
<requestId>7a62c49f-347e-4fc4-9331-6e8eEXAMPLE</requestId>
|
||||||
|
<accountAttributeSet>
|
||||||
|
<item>
|
||||||
|
<attributeName>vpc-max-security-groups-per-interface</attributeName>
|
||||||
|
<attributeValueSet>
|
||||||
|
<item>
|
||||||
|
<attributeValue>5</attributeValue>
|
||||||
|
</item>
|
||||||
|
</attributeValueSet>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attributeName>max-instances</attributeName>
|
||||||
|
<attributeValueSet>
|
||||||
|
<item>
|
||||||
|
<attributeValue>20</attributeValue>
|
||||||
|
</item>
|
||||||
|
</attributeValueSet>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attributeName>supported-platforms</attributeName>
|
||||||
|
<attributeValueSet>
|
||||||
|
<item>
|
||||||
|
<attributeValue>EC2</attributeValue>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attributeValue>VPC</attributeValue>
|
||||||
|
</item>
|
||||||
|
</attributeValueSet>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attributeName>default-vpc</attributeName>
|
||||||
|
<attributeValueSet>
|
||||||
|
<item>
|
||||||
|
<attributeValue>none</attributeValue>
|
||||||
|
</item>
|
||||||
|
</attributeValueSet>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attributeName>max-elastic-ips</attributeName>
|
||||||
|
<attributeValueSet>
|
||||||
|
<item>
|
||||||
|
<attributeValue>5</attributeValue>
|
||||||
|
</item>
|
||||||
|
</attributeValueSet>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<attributeName>vpc-max-elastic-ips</attributeName>
|
||||||
|
<attributeValueSet>
|
||||||
|
<item>
|
||||||
|
<attributeValue>5</attributeValue>
|
||||||
|
</item>
|
||||||
|
</attributeValueSet>
|
||||||
|
</item>
|
||||||
|
</accountAttributeSet>
|
||||||
|
</DescribeAccountAttributesResponse>
|
||||||
|
"""
|
44
tests/test_ec2/test_account_attributes.py
Normal file
44
tests/test_ec2/test_account_attributes.py
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
from __future__ import unicode_literals
|
||||||
|
import boto3
|
||||||
|
from moto import mock_ec2
|
||||||
|
import sure # noqa
|
||||||
|
|
||||||
|
|
||||||
|
@mock_ec2
|
||||||
|
def test_describe_account_attributes():
|
||||||
|
conn = boto3.client('ec2', region_name='us-east-1')
|
||||||
|
response = conn.describe_account_attributes()
|
||||||
|
expected_attribute_values = [{
|
||||||
|
'AttributeValues': [{
|
||||||
|
'AttributeValue': '5'
|
||||||
|
}],
|
||||||
|
'AttributeName': 'vpc-max-security-groups-per-interface'
|
||||||
|
}, {
|
||||||
|
'AttributeValues': [{
|
||||||
|
'AttributeValue': '20'
|
||||||
|
}],
|
||||||
|
'AttributeName': 'max-instances'
|
||||||
|
}, {
|
||||||
|
'AttributeValues': [{
|
||||||
|
'AttributeValue': 'EC2'
|
||||||
|
}, {
|
||||||
|
'AttributeValue': 'VPC'
|
||||||
|
}],
|
||||||
|
'AttributeName': 'supported-platforms'
|
||||||
|
}, {
|
||||||
|
'AttributeValues': [{
|
||||||
|
'AttributeValue': 'none'
|
||||||
|
}],
|
||||||
|
'AttributeName': 'default-vpc'
|
||||||
|
}, {
|
||||||
|
'AttributeValues': [{
|
||||||
|
'AttributeValue': '5'
|
||||||
|
}],
|
||||||
|
'AttributeName': 'max-elastic-ips'
|
||||||
|
}, {
|
||||||
|
'AttributeValues': [{
|
||||||
|
'AttributeValue': '5'
|
||||||
|
}],
|
||||||
|
'AttributeName': 'vpc-max-elastic-ips'
|
||||||
|
}]
|
||||||
|
response['AccountAttributes'].should.equal(expected_attribute_values)
|
Loading…
Reference in New Issue
Block a user