From 50d71eccbee12ce5cf2c1ecf61bfcbd60317976d Mon Sep 17 00:00:00 2001 From: Matt Williams Date: Wed, 29 Jul 2020 18:36:37 +0100 Subject: [PATCH] Fix XML schema for ec2.describe_instance_types (#3194) * Add test for describe_instance_types It currently fails due to an invalid XML schema * Add more detail to test * Fix the XML schema for describe_instance_types --- moto/ec2/responses/instances.py | 26 +++++++++++++++++++------- tests/test_ec2/test_instance_types.py | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 tests/test_ec2/test_instance_types.py diff --git a/moto/ec2/responses/instances.py b/moto/ec2/responses/instances.py index 9090847b..e9843399 100644 --- a/moto/ec2/responses/instances.py +++ b/moto/ec2/responses/instances.py @@ -818,13 +818,25 @@ EC2_DESCRIBE_INSTANCE_TYPES = """ {% for instance_type in instance_types %} - {{ instance_type.name }} - {{ instance_type.cores }} - {{ instance_type.memory }} - {{ instance_type.disk }} - {{ instance_type.storageCount }} - {{ instance_type.maxIpAddresses }} - {{ instance_type.ebsOptimizedAvailable }} + {{ instance_type.name }} + + {{ instance_type.cores }} + {{ instance_type.cores }} + 1 + + + {{ instance_type.memory }} + + + {{ instance_type.disk }} + + + + + x86_64 + + + {% endfor %} diff --git a/tests/test_ec2/test_instance_types.py b/tests/test_ec2/test_instance_types.py new file mode 100644 index 00000000..1385d611 --- /dev/null +++ b/tests/test_ec2/test_instance_types.py @@ -0,0 +1,18 @@ +from __future__ import unicode_literals + +import boto3 +import sure # noqa + +from moto import mock_ec2 + + +@mock_ec2 +def test_describe_instance_types(): + client = boto3.client("ec2", "us-east-1") + instance_types = client.describe_instance_types() + + instance_types.should.have.key("InstanceTypes") + instance_types["InstanceTypes"].should_not.be.empty + instance_types["InstanceTypes"][0].should.have.key("InstanceType") + instance_types["InstanceTypes"][0].should.have.key("MemoryInfo") + instance_types["InstanceTypes"][0]["MemoryInfo"].should.have.key("SizeInMiB")