Add more availability regions and implement default VPC (#773)
Fix filter name for availability zone Fix bug assuming dict keys are ordered Fix tests Fix tests Fix bug
This commit is contained in:
parent
231d3cadcb
commit
02324ad708
13 changed files with 218 additions and 142 deletions
|
|
@ -1,5 +1,7 @@
|
|||
from __future__ import unicode_literals
|
||||
import boto
|
||||
import boto.ec2
|
||||
import boto3
|
||||
import sure # noqa
|
||||
|
||||
from moto import mock_ec2
|
||||
|
|
@ -9,16 +11,39 @@ from moto import mock_ec2
|
|||
def test_describe_regions():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
regions = conn.get_all_regions()
|
||||
regions.should.have.length_of(8)
|
||||
regions[0].name.should.equal('eu-west-1')
|
||||
regions[0].endpoint.should.equal('ec2.eu-west-1.amazonaws.com')
|
||||
regions.should.have.length_of(14)
|
||||
for region in regions:
|
||||
region.endpoint.should.contain(region.name)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_availability_zones():
|
||||
# Just testing us-east-1 for now
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
zones = conn.get_all_zones()
|
||||
zones.should.have.length_of(5)
|
||||
zones[0].name.should.equal('us-east-1a')
|
||||
zones[0].region_name.should.equal('us-east-1')
|
||||
regions = conn.get_all_regions()
|
||||
for region in regions:
|
||||
conn = boto.ec2.connect_to_region(region.name)
|
||||
if conn is None:
|
||||
continue
|
||||
for zone in conn.get_all_zones():
|
||||
zone.name.should.contain(region.name)
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_boto3_describe_regions():
|
||||
ec2 = boto3.client('ec2', 'us-east-1')
|
||||
resp = ec2.describe_regions()
|
||||
resp['Regions'].should.have.length_of(14)
|
||||
for rec in resp['Regions']:
|
||||
rec['Endpoint'].should.contain(rec['RegionName'])
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_boto3_availability_zones():
|
||||
ec2 = boto3.client('ec2', 'us-east-1')
|
||||
resp = ec2.describe_regions()
|
||||
regions = [r['RegionName'] for r in resp['Regions']]
|
||||
for region in regions:
|
||||
conn = boto3.client('ec2', region)
|
||||
resp = conn.describe_availability_zones()
|
||||
for rec in resp['AvailabilityZones']:
|
||||
rec['ZoneName'].should.contain(region)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue