Revert this solution in favor of fc0fb0d40e39f6aeeb5969f31f5b074ebe37f76a.
This commit is contained in:
		
							parent
							
								
									3a2eedc03c
								
							
						
					
					
						commit
						f7c775d7ab
					
				@ -10,10 +10,6 @@ class AutoScalingResponse(BaseResponse):
 | 
			
		||||
    def autoscaling_backend(self):
 | 
			
		||||
        return autoscaling_backends[self.region]
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def boto3_request(self):
 | 
			
		||||
        return 'Boto3' in self.headers.get('User-Agent', [])
 | 
			
		||||
 | 
			
		||||
    def create_launch_configuration(self):
 | 
			
		||||
        instance_monitoring_string = self._get_param('InstanceMonitoring.Enabled')
 | 
			
		||||
        if instance_monitoring_string == 'true':
 | 
			
		||||
@ -72,11 +68,6 @@ class AutoScalingResponse(BaseResponse):
 | 
			
		||||
    def describe_auto_scaling_groups(self):
 | 
			
		||||
        names = self._get_multi_param("AutoScalingGroupNames.member")
 | 
			
		||||
        groups = self.autoscaling_backend.describe_autoscaling_groups(names)
 | 
			
		||||
        if self.boto3_request:
 | 
			
		||||
            for group in groups:
 | 
			
		||||
                if group.health_check_period is None:
 | 
			
		||||
                    group.health_check_period = 300
 | 
			
		||||
                self.autoscaling_backend.autoscaling_groups[group.name] = group
 | 
			
		||||
        template = self.response_template(DESCRIBE_AUTOSCALING_GROUPS_TEMPLATE)
 | 
			
		||||
        return template.render(groups=groups)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,41 +0,0 @@
 | 
			
		||||
from __future__ import unicode_literals
 | 
			
		||||
import boto3
 | 
			
		||||
import sure  # noqa
 | 
			
		||||
 | 
			
		||||
from moto import mock_autoscaling
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@mock_autoscaling
 | 
			
		||||
def test_create_autoscaling_group():
 | 
			
		||||
        client = boto3.client('autoscaling', region_name='us-east-1')
 | 
			
		||||
        _ = client.create_launch_configuration(
 | 
			
		||||
            LaunchConfigurationName='test_launch_configuration'
 | 
			
		||||
        )
 | 
			
		||||
        response = client.create_auto_scaling_group(
 | 
			
		||||
            AutoScalingGroupName='test_asg',
 | 
			
		||||
            LaunchConfigurationName='test_launch_configuration',
 | 
			
		||||
            MinSize=0,
 | 
			
		||||
            MaxSize=20,
 | 
			
		||||
            DesiredCapacity=5
 | 
			
		||||
        )
 | 
			
		||||
        response['ResponseMetadata']['HTTPStatusCode'].should.equal(200)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@mock_autoscaling
 | 
			
		||||
def test_describe_autoscaling_groups():
 | 
			
		||||
        client = boto3.client('autoscaling', region_name='us-east-1')
 | 
			
		||||
        _ = client.create_launch_configuration(
 | 
			
		||||
            LaunchConfigurationName='test_launch_configuration'
 | 
			
		||||
        )
 | 
			
		||||
        _ = client.create_auto_scaling_group(
 | 
			
		||||
            AutoScalingGroupName='test_asg',
 | 
			
		||||
            LaunchConfigurationName='test_launch_configuration',
 | 
			
		||||
            MinSize=0,
 | 
			
		||||
            MaxSize=20,
 | 
			
		||||
            DesiredCapacity=5
 | 
			
		||||
        )
 | 
			
		||||
        response = client.describe_auto_scaling_groups(
 | 
			
		||||
            AutoScalingGroupNames=["test_asg"]
 | 
			
		||||
        )
 | 
			
		||||
        response['ResponseMetadata']['HTTPStatusCode'].should.equal(200)
 | 
			
		||||
        response['AutoScalingGroups'][0]['AutoScalingGroupName'].should.equal('test_asg')
 | 
			
		||||
@ -1,23 +0,0 @@
 | 
			
		||||
from __future__ import unicode_literals
 | 
			
		||||
import boto3
 | 
			
		||||
 | 
			
		||||
import sure  # noqa
 | 
			
		||||
 | 
			
		||||
from moto import mock_autoscaling
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@mock_autoscaling
 | 
			
		||||
def test_create_launch_configuration():
 | 
			
		||||
    client = boto3.client('autoscaling', region_name='us-east-1')
 | 
			
		||||
    response = client.create_launch_configuration(
 | 
			
		||||
        LaunchConfigurationName='tester',
 | 
			
		||||
        ImageId='ami-abcd1234',
 | 
			
		||||
        InstanceType='t1.micro',
 | 
			
		||||
        KeyName='the_keys',
 | 
			
		||||
        SecurityGroups=["default", "default2"],
 | 
			
		||||
        UserData="This is some user_data",
 | 
			
		||||
        InstanceMonitoring={'Enabled': True},
 | 
			
		||||
        IamInstanceProfile='arn:aws:iam::123456789012:instance-profile/testing',
 | 
			
		||||
        SpotPrice='0.1'
 | 
			
		||||
    )
 | 
			
		||||
    response['ResponseMetadata']['HTTPStatusCode'].should.equal(200)
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user