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
This commit is contained in:
		
							parent
							
								
									08a08b6af8
								
							
						
					
					
						commit
						50d71eccbe
					
				| @ -818,13 +818,25 @@ EC2_DESCRIBE_INSTANCE_TYPES = """<?xml version="1.0" encoding="UTF-8"?> | |||||||
|     <instanceTypeSet> |     <instanceTypeSet> | ||||||
|     {% for instance_type in instance_types %} |     {% for instance_type in instance_types %} | ||||||
|         <item> |         <item> | ||||||
|             <name>{{ instance_type.name }}</name> |             <instanceType>{{ instance_type.name }}</instanceType> | ||||||
|             <vcpu>{{ instance_type.cores }}</vcpu> |             <vCpuInfo> | ||||||
|             <memory>{{ instance_type.memory }}</memory> |                 <defaultVCpus>{{ instance_type.cores }}</defaultVCpus> | ||||||
|             <storageSize>{{ instance_type.disk }}</storageSize> |                 <defaultCores>{{ instance_type.cores }}</defaultCores> | ||||||
|             <storageCount>{{ instance_type.storageCount }}</storageCount> |                 <defaultThreadsPerCore>1</defaultThreadsPerCore> | ||||||
|             <maxIpAddresses>{{ instance_type.maxIpAddresses }}</maxIpAddresses> |             </vCpuInfo> | ||||||
|             <ebsOptimizedAvailable>{{ instance_type.ebsOptimizedAvailable }}</ebsOptimizedAvailable> |             <memoryInfo> | ||||||
|  |                 <sizeInMiB>{{ instance_type.memory }}</sizeInMiB> | ||||||
|  |             </memoryInfo> | ||||||
|  |             <instanceStorageInfo> | ||||||
|  |                 <totalSizeInGB>{{ instance_type.disk }}</totalSizeInGB> | ||||||
|  |             </instanceStorageInfo> | ||||||
|  |             <processorInfo> | ||||||
|  |                 <supportedArchitectures> | ||||||
|  |                     <item> | ||||||
|  |                         x86_64 | ||||||
|  |                     </item> | ||||||
|  |                 </supportedArchitectures> | ||||||
|  |             </processorInfo> | ||||||
|         </item> |         </item> | ||||||
|     {% endfor %} |     {% endfor %} | ||||||
|     </instanceTypeSet> |     </instanceTypeSet> | ||||||
|  | |||||||
							
								
								
									
										18
									
								
								tests/test_ec2/test_instance_types.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								tests/test_ec2/test_instance_types.py
									
									
									
									
									
										Normal file
									
								
							| @ -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") | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user