def test_describe_auto_scaling_groups_tags(aws_client): client = MagicMock() aws_client.return_value = client tags = [{"Key": "TestKey", "Value": "TestValue"}] client.get_paginator.return_value.paginate.return_value = [ { "AutoScalingGroups": [ { "AutoScalingGroupName": "AutoScalingGroup-A", "Tags": [ { "ResourceId": "AutoScalingGroup-A", "Key": "TestKey", "Value": "TestValue", } ], }, { "AutoScalingGroupName": "AutoScalingGroup-B", "Tags": [ { "ResourceId": "AutoScalingGroup-B", "Key": "TestKey", "Value": "TestValue", } ], }, ] } ] client.describe_auto_scaling_groups.return_value = { "AutoScalingGroups": [ { "AutoScalingGroupName": "AutoScalingGroup-A", "Instances": [], "Tags": [ { "ResourceId": "AutoScalingGroup-A", "Key": "TestKey", "Value": "TestValue", } ], }, { "AutoScalingGroupName": "AutoScalingGroup-B", "Instances": [], "Tags": [ { "ResourceId": "AutoScalingGroup-B", "Key": "TestKey", "Value": "TestValue", } ], }, ] } describe_auto_scaling_groups(tags=tags) client.describe_auto_scaling_groups.assert_called_with( AutoScalingGroupNames=["AutoScalingGroup-A", "AutoScalingGroup-B"] )
def test_describe_auto_scaling_groups_names(aws_client): client = MagicMock() aws_client.return_value = client asg_names = ['AutoScalingGroup-A'] client.get_paginator.return_value.paginate.return_value = [{ "AutoScalingGroups": [{ "AutoScalingGroupName": "AutoScalingGroup-A", "Tags": [{ "ResourceId": "AutoScalingGroup-A", "Key": "TestKey", "Value": "TestValue"}]}]}] describe_auto_scaling_groups(asg_names=asg_names) client.get_paginator.return_value.paginate.assert_called_with( AutoScalingGroupNames=asg_names)