Path: blob/develop/tests/functional/autoscale/test_terminate_instance_in_autoscaling_group.py
1567 views
#!/usr/bin/env python1# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.2#3# Licensed under the Apache License, Version 2.0 (the "License"). You4# may not use this file except in compliance with the License. A copy of5# the License is located at6#7# http://aws.amazon.com/apache2.0/8#9# or in the "license" file accompanying this file. This file is10# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF11# ANY KIND, either express or implied. See the License for the specific12# language governing permissions and limitations under the License.13from awscli.testutils import BaseAWSCommandParamsTest141516class TestTerminateInstanceInAutoscalingGroup(BaseAWSCommandParamsTest):1718PREFIX = 'autoscaling terminate-instance-in-auto-scaling-group'1920def test_true(self):21cmdline = self.PREFIX22cmdline += ' --instance-id i-12345678'23cmdline += ' --should-decrement-desired-capacity'24params = {'InstanceId': 'i-12345678',25'ShouldDecrementDesiredCapacity': True}26self.assert_params_for_cmd(cmdline, params)2728def test_false(self):29cmdline = self.PREFIX30cmdline += ' --instance-id i-12345678'31cmdline += ' --no-should-decrement-desired-capacity'32params = {'InstanceId': 'i-12345678',33'ShouldDecrementDesiredCapacity': False}34self.assert_params_for_cmd(cmdline, params)3536def test_last_arg_wins(self):37cmdline = self.PREFIX38cmdline += ' --instance-id i-12345678'39cmdline += ' --should-decrement-desired-capacity'40cmdline += ' --no-should-decrement-desired-capacity'41# Since the --no-should-decrement-desired-capacity was42# was added last, it wins.43params = {'InstanceId': 'i-12345678',44'ShouldDecrementDesiredCapacity': False}45self.assert_params_for_cmd(cmdline, params)464748