Path: blob/develop/tests/unit/customizations/ecs/test_ecsclient.py
1569 views
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.1#2# Licensed under the Apache License, Version 2.0 (the "License"). You3# may not use this file except in compliance with the License. A copy of4# the License is located at5#6# http://aws.amazon.com/apache2.0/7#8# or in the "license" file accompanying this file. This file is9# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF10# ANY KIND, either express or implied. See the License for the specific11# language governing permissions and limitations under the License.1213from argparse import Namespace14from botocore import config15from awscli.testutils import capture_output, mock, unittest16from awscli.customizations.ecs.deploy import ECSClient, ECSDeploy171819class TestECSClient(unittest.TestCase):2021def setUp(self):22ecs_client = mock.Mock()23self.session = mock.Mock()24self.session.create_client.side_effect = ecs_client2526# set global args27self.global_args = Namespace()28self.global_args.region = 'us-east-1'29self.global_args.endpoint_url = None30self.global_args.verify_ssl = None3132def test_client_config(self):33self.test_client = ECSClient(34self.session, None, self.global_args, ECSDeploy.USER_AGENT_EXTRA)3536expected_user_agent_extra = 'customization/ecs-deploy'3738create_args = self.session.create_client.call_args39self.assertEqual(create_args[0][0], 'ecs')40self.assertEqual(41create_args[1]['region_name'], self.global_args.region)42self.assertEqual(create_args[1]['config'].user_agent_extra,43expected_user_agent_extra)444546