Change test_regions.py to work with old boto versions

This commit is contained in:
Hugo Lopes Tavares 2014-08-26 18:38:08 -04:00
parent bce64599f7
commit 55400038a8

View File

@ -17,12 +17,12 @@ def test_add_servers_to_a_single_region():
add_servers_to_region('ami-5678efgh', 1, region)
conn = boto.ec2.connect_to_region(region)
instances = conn.get_only_instances()
len(instances).should.equal(2)
instances.sort(key=lambda x: x.image_id)
reservations = conn.get_all_instances()
len(reservations).should.equal(2)
reservations.sort(key=lambda x: x.instances[0].image_id)
instances[0].image_id.should.equal('ami-1234abcd')
instances[1].image_id.should.equal('ami-5678efgh')
reservations[0].instances[0].image_id.should.equal('ami-1234abcd')
reservations[1].instances[0].image_id.should.equal('ami-5678efgh')
@mock_ec2
@ -34,14 +34,14 @@ def test_add_servers_to_multiple_regions():
us_conn = boto.ec2.connect_to_region(region1)
ap_conn = boto.ec2.connect_to_region(region2)
us_instances = us_conn.get_only_instances()
ap_instances = ap_conn.get_only_instances()
us_reservations = us_conn.get_all_instances()
ap_reservations = ap_conn.get_all_instances()
len(us_instances).should.equal(1)
len(ap_instances).should.equal(1)
len(us_reservations).should.equal(1)
len(ap_reservations).should.equal(1)
us_instances[0].image_id.should.equal('ami-1234abcd')
ap_instances[0].image_id.should.equal('ami-5678efgh')
us_reservations[0].instances[0].image_id.should.equal('ami-1234abcd')
ap_reservations[0].instances[0].image_id.should.equal('ami-5678efgh')
@mock_autoscaling