

def test_ec2_run_instances(self):
    i = InfrastructureManager(blocking=True)
    full_params = {
        'credentials': {
            'a': 'b',
            'EC2_URL': 'http://testing.appscale.com:8773/foo/bar',
            'EC2_ACCESS_KEY': 'access_key',
            'EC2_SECRET_KEY': 'secret_key',
        },
        'group': 'boogroup',
        'image_id': 'booid',
        'infrastructure': 'ec2',
        'instance_type': 'booinstance_type',
        'keyname': 'bookeyname',
        'num_vms': '1',
        'use_spot_instances': 'True',
        'max_spot_price': '1.23',
        'region': 'my-zone-1',
        'zone': 'my-zone-1b',
    }
    id = '0000000000'
    full_result = {
        'success': True,
        'reservation_id': id,
        'reason': 'none',
    }
    self.assertEquals(full_result, i.run_instances(full_params, 'secret'))
    self.assertEquals(InfrastructureManager.STATE_RUNNING, i.reservations.get(id)['state'])
    vm_info = i.reservations.get(id)['vm_info']
    self.assertEquals(['public-ip'], vm_info['public_ips'])
    self.assertEquals(['private-ip'], vm_info['private_ips'])
    self.assertEquals(['i-id'], vm_info['instance_ids'])

dataset/ETHPy150Open AppScale/appscale/InfrastructureManager/tests/test_ec2_agent_w_spot.py TestEC2Agent.test_ec2_run_instances/original