Boto3 and cloudformation have different keys for auto scaling tags - handle that gracefully

This commit is contained in:
William Richard 2017-06-21 12:58:01 -04:00
commit c5ce2848be
No known key found for this signature in database
GPG key ID: F7F8BA4DDBE1ABED
3 changed files with 115 additions and 56 deletions

View file

@ -138,6 +138,7 @@ def test_list_many_autoscaling_groups():
groups.should.have.length_of(51)
assert 'NextToken' not in response2.keys()
@mock_autoscaling
@mock_ec2
def test_list_many_autoscaling_groups():
@ -163,6 +164,7 @@ def test_list_many_autoscaling_groups():
tags.should.contain({u'Value': 'TestTagValue1', u'Key': 'TestTagKey1'})
tags.should.contain({u'Value': 'TestGroup1', u'Key': 'aws:autoscaling:groupName'})
@mock_autoscaling_deprecated
def test_autoscaling_group_describe_filter():
conn = boto.connect_autoscale()
@ -493,7 +495,20 @@ def test_create_autoscaling_group_boto3():
LaunchConfigurationName='test_launch_configuration',
MinSize=0,
MaxSize=20,
DesiredCapacity=5
DesiredCapacity=5,
Tags=[
{'ResourceId': 'test_asg',
'ResourceType': 'auto-scaling-group',
'Key': 'propogated-tag-key',
'Value': 'propogate-tag-value',
'PropagateAtLaunch': True
},
{'ResourceId': 'test_asg',
'ResourceType': 'auto-scaling-group',
'Key': 'not-propogated-tag-key',
'Value': 'not-propogate-tag-value',
'PropagateAtLaunch': False
}]
)
response['ResponseMetadata']['HTTPStatusCode'].should.equal(200)
@ -556,12 +571,14 @@ def test_autoscaling_taqs_update_boto3():
MinSize=0,
MaxSize=20,
DesiredCapacity=5,
Tags=[{
"ResourceId": 'test_asg',
"Key": 'test_key',
"Value": 'test_value',
"PropagateAtLaunch": True
}]
Tags=[
{
"ResourceId": 'test_asg',
"Key": 'test_key',
"Value": 'test_value',
"PropagateAtLaunch": True
},
]
)
client.create_or_update_tags(Tags=[{
@ -573,7 +590,7 @@ def test_autoscaling_taqs_update_boto3():
"ResourceId": 'test_asg',
"Key": 'test_key2',
"Value": 'test_value2',
"PropagateAtLaunch": True
"PropagateAtLaunch": False
}])
response = client.describe_auto_scaling_groups(