def test_delete_group_ec2_classic(self): """ test deletion of a group in EC2-Classic. Test does the following: 1. creates two groups, in EC2-Classic and one in EC2-VPC 2. saves the group_ids to group_ids_pre_delete 3. removes the group in EC2-VPC 4. saves the group ids of groups to group_ids_post_delete 5. compares the group_ids_pre_delete and group_ids_post_delete lists to ensure that the correct group was deleted """ group_name = _random_group_name() group_description = "test_delete_group_ec2_classic" # create two groups using boto, one in EC2-Classic and one in EC2-VPC conn = boto.ec2.connect_to_region(region, **boto_conn_parameters) group_classic = conn.create_security_group( name=group_name, description=group_description) group_vpc = conn.create_security_group(name=group_name, description=group_description, vpc_id=vpc_id) # creates a list of all the existing all_group_ids in an AWS account all_groups = [group.id for group in conn.get_all_security_groups()] # removes the EC2-Classic Security Group deleted = boto_secgroup.delete(name=group_name, **conn_parameters) expected_groups = deepcopy(all_groups) expected_groups.remove(group_classic.id) actual_groups = [group.id for group in conn.get_all_security_groups()] assert expected_groups == actual_groups
def test_delete_group_ec2_classic(self): ''' test deletion of a group in EC2-Classic. Test does the following: 1. creates two groups, in EC2-Classic and one in EC2-VPC 2. saves the group_ids to group_ids_pre_delete 3. removes the group in EC2-VPC 4. saves the group ids of groups to group_ids_post_delete 5. compares the group_ids_pre_delete and group_ids_post_delete lists to ensure that the correct group was deleted ''' group_name = _random_group_name() group_description = 'test_delete_group_ec2_classic' # create two groups using boto, one in EC2-Classic and one in EC2-VPC conn = boto.ec2.connect_to_region(region, **boto_conn_parameters) group_classic = conn.create_security_group(name=group_name, description=group_description) group_vpc = conn.create_security_group(name=group_name, description=group_description, vpc_id=vpc_id) # creates a list of all the existing all_group_ids in an AWS account all_groups = [group.id for group in conn.get_all_security_groups()] # removes the EC2-Classic Security Group deleted = boto_secgroup.delete(name=group_name, **conn_parameters) expected_groups = deepcopy(all_groups) expected_groups.remove(group_classic.id) actual_groups = [group.id for group in conn.get_all_security_groups()] self.assertEqual(expected_groups, actual_groups)