Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/functional/autoscale/test_terminate_instance_in_autoscaling_group.py
1567 views
1
#!/usr/bin/env python
2
# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License"). You
5
# may not use this file except in compliance with the License. A copy of
6
# the License is located at
7
#
8
# http://aws.amazon.com/apache2.0/
9
#
10
# or in the "license" file accompanying this file. This file is
11
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
# ANY KIND, either express or implied. See the License for the specific
13
# language governing permissions and limitations under the License.
14
from awscli.testutils import BaseAWSCommandParamsTest
15
16
17
class TestTerminateInstanceInAutoscalingGroup(BaseAWSCommandParamsTest):
18
19
PREFIX = 'autoscaling terminate-instance-in-auto-scaling-group'
20
21
def test_true(self):
22
cmdline = self.PREFIX
23
cmdline += ' --instance-id i-12345678'
24
cmdline += ' --should-decrement-desired-capacity'
25
params = {'InstanceId': 'i-12345678',
26
'ShouldDecrementDesiredCapacity': True}
27
self.assert_params_for_cmd(cmdline, params)
28
29
def test_false(self):
30
cmdline = self.PREFIX
31
cmdline += ' --instance-id i-12345678'
32
cmdline += ' --no-should-decrement-desired-capacity'
33
params = {'InstanceId': 'i-12345678',
34
'ShouldDecrementDesiredCapacity': False}
35
self.assert_params_for_cmd(cmdline, params)
36
37
def test_last_arg_wins(self):
38
cmdline = self.PREFIX
39
cmdline += ' --instance-id i-12345678'
40
cmdline += ' --should-decrement-desired-capacity'
41
cmdline += ' --no-should-decrement-desired-capacity'
42
# Since the --no-should-decrement-desired-capacity was
43
# was added last, it wins.
44
params = {'InstanceId': 'i-12345678',
45
'ShouldDecrementDesiredCapacity': False}
46
self.assert_params_for_cmd(cmdline, params)
47
48