@mock_ec2_deprecated
@mock_elb_deprecated
def test_deregister_instances_valid_id_string(self):
    '\n        tests that given an valid id the boto_elb deregister_instances method\n        removes exactly one of a number of ELB registered instances\n        '
    conn_ec2 = boto.ec2.connect_to_region(region, **boto_conn_parameters)
    conn_elb = boto.ec2.elb.connect_to_region(region, **boto_conn_parameters)
    zones = [zone.name for zone in conn_ec2.get_all_zones()]
    elb_name = 'TestDeregisterInstancesValidIdString'
    load_balancer = conn_elb.create_load_balancer(elb_name, zones, [(80, 80, 'http')])
    reservations = conn_ec2.run_instances('ami-08389d60', min_count=2)
    all_instance_ids = [instance.id for instance in reservations.instances]
    load_balancer.register_instances(all_instance_ids)
    boto_elb.deregister_instances(elb_name, reservations.instances[0].id, **conn_parameters)
    load_balancer_refreshed = conn_elb.get_all_load_balancers(elb_name)[0]
    expected_instances = deepcopy(all_instance_ids)
    expected_instances.remove(reservations.instances[0].id)
    actual_instances = [instance.id for instance in load_balancer_refreshed.instances]
    self.assertEqual(actual_instances, expected_instances)
tests that given an valid id the boto_elb deregister_instances method
removes exactly one of a number of ELB registered instances
@mock_ec2_deprecated
@mock_elb_deprecated
def test_deregister_instances_valid_id_string(self):
    '\n        tests that given an valid id the boto_elb deregister_instances method\n        removes exactly one of a number of ELB registered instances\n        '
    conn_ec2 = boto.ec2.connect_to_region(region, **boto_conn_parameters)
    conn_elb = boto.ec2.elb.connect_to_region(region, **boto_conn_parameters)
    zones = [zone.name for zone in conn_ec2.get_all_zones()]
    elb_name = 'TestDeregisterInstancesValidIdString'
    load_balancer = conn_elb.create_load_balancer(elb_name, zones, [(80, 80, 'http')])
    reservations = conn_ec2.run_instances('ami-08389d60', min_count=2)
    all_instance_ids = [instance.id for instance in reservations.instances]
    load_balancer.register_instances(all_instance_ids)
    boto_elb.deregister_instances(elb_name, reservations.instances[0].id, **conn_parameters)
    load_balancer_refreshed = conn_elb.get_all_load_balancers(elb_name)[0]
    expected_instances = deepcopy(all_instance_ids)
    expected_instances.remove(reservations.instances[0].id)
    actual_instances = [instance.id for instance in load_balancer_refreshed.instances]
    self.assertEqual(actual_instances, expected_instances)