Path: blob/develop/tests/functional/elb/test_configure_health_check.py
1567 views
#!/usr/bin/env python1# Copyright 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 TestConfigureHealthCheck(BaseAWSCommandParamsTest):1718prefix = 'elb configure-health-check'1920def test_shorthand_basic(self):21cmdline = self.prefix22cmdline += ' --load-balancer-name my-lb'23cmdline += (' --health-check Target=HTTP:80/weather/us/wa/seattle,'24'Interval=300,Timeout=60,UnhealthyThreshold=5,'25'HealthyThreshold=9')26result = {27'HealthCheck': {28'HealthyThreshold': 9,29'Interval': 300,30'Target': 'HTTP:80/weather/us/wa/seattle',31'Timeout': 60,32'UnhealthyThreshold': 5},33'LoadBalancerName': 'my-lb'}34self.assert_params_for_cmd(cmdline, result)3536def test_json(self):37cmdline = self.prefix38cmdline += ' --load-balancer-name my-lb '39cmdline += ('--health-check {"Target":"HTTP:80/weather/us/wa/seattle'40'?a=b","Interval":300,"Timeout":60,'41'"UnhealthyThreshold":5,"HealthyThreshold":9}')42result = {43'HealthCheck': {44'HealthyThreshold': 9,45'Interval': 300,46'Target': 'HTTP:80/weather/us/wa/seattle?a=b',47'Timeout': 60,48'UnhealthyThreshold': 5},49'LoadBalancerName': 'my-lb'}50self.assert_params_for_cmd(cmdline, result)5152def test_shorthand_with_multiple_equals_for_value(self):53cmdline = self.prefix54cmdline += ' --load-balancer-name my-lb'55cmdline += (56' --health-check Target="HTTP:80/weather/us/wa/seattle?a=b"'57',Interval=300,Timeout=60,UnhealthyThreshold=5,'58'HealthyThreshold=9'59)60result = {61'HealthCheck': {62'HealthyThreshold': 9,63'Interval': 300,64'Target': 'HTTP:80/weather/us/wa/seattle?a=b',65'Timeout': 60,66'UnhealthyThreshold': 5},67'LoadBalancerName': 'my-lb'}68self.assert_params_for_cmd(cmdline, result)697071