@mock_ec2
def test_request_spot_instances_setting_instance_id():
    conn = boto.ec2.connect_to_region('us-east-1')
    request = conn.request_spot_instances(price=0.5, image_id='ami-abcd1234')
    req = get_model('SpotInstanceRequest')[0]
    req.state = 'active'
    req.instance_id = 'i-12345678'
    request = conn.get_all_spot_instance_requests()[0]
    assert (request.state == 'active')
    assert (request.instance_id == 'i-12345678')
@mock_ec2
def test_request_spot_instances_setting_instance_id():
    conn = boto.ec2.connect_to_region('us-east-1')
    request = conn.request_spot_instances(price=0.5, image_id='ami-abcd1234')
    req = get_model('SpotInstanceRequest')[0]
    req.state = 'active'
    req.instance_id = 'i-12345678'
    request = conn.get_all_spot_instance_requests()[0]
    assert (request.state == 'active')
    assert (request.instance_id == 'i-12345678')