def test_autoscaling_group_describe_filter(): mocked_networking = setup_networking_deprecated() conn = boto.connect_autoscale() config = LaunchConfiguration( name='tester', image_id='ami-abcd1234', instance_type='t2.medium', ) conn.create_launch_configuration(config) group = AutoScalingGroup( name='tester_group', max_size=2, min_size=2, launch_config=config, vpc_zone_identifier=mocked_networking['subnet1'], ) conn.create_auto_scaling_group(group) group.name = 'tester_group2' conn.create_auto_scaling_group(group) group.name = 'tester_group3' conn.create_auto_scaling_group(group) conn.get_all_groups( names=['tester_group', 'tester_group2']).should.have.length_of(2) conn.get_all_groups().should.have.length_of(3)
def test_autoscaling_group_describe_filter(): conn = boto.connect_autoscale() config = LaunchConfiguration( name='tester', image_id='ami-abcd1234', instance_type='t2.medium', ) conn.create_launch_configuration(config) group = AutoScalingGroup( name='tester_group', max_size=2, min_size=2, launch_config=config, ) conn.create_auto_scaling_group(group) group.name = 'tester_group2' conn.create_auto_scaling_group(group) group.name = 'tester_group3' conn.create_auto_scaling_group(group) conn.get_all_groups(names=['tester_group', 'tester_group2']).should.have.length_of(2) conn.get_all_groups().should.have.length_of(3)
def get_all_groups(names=None, max_records=None, next_token=None): groups = [] for i in xrange(1, 3): tags = [ boto.ec2.autoscale.tag.Tag( None, key='aws:cloudformation:stack-name', value='test{0}'.format(i)) ] asg = AutoScalingGroup() asg.name = 'test{0}'.format(i) asg.tags = tags groups.append(asg) return groups
def get_all_groups(names=None, max_records=None, next_token=None): groups = ResultSet() for i in xrange(1, 3): tags = [ boto.ec2.autoscale.tag.Tag( None, key='aws:cloudformation:stack-name', value='test{0}'.format(i)) ] asg = AutoScalingGroup() asg.name = 'test{0}'.format(i) asg.tags = tags groups.append(asg) groups.next_token = None return groups