Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/unit/customizations/ecs/test_ecsclient.py
1569 views
1
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License"). You
4
# may not use this file except in compliance with the License. A copy of
5
# the License is located at
6
#
7
# http://aws.amazon.com/apache2.0/
8
#
9
# or in the "license" file accompanying this file. This file is
10
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
# ANY KIND, either express or implied. See the License for the specific
12
# language governing permissions and limitations under the License.
13
14
from argparse import Namespace
15
from botocore import config
16
from awscli.testutils import capture_output, mock, unittest
17
from awscli.customizations.ecs.deploy import ECSClient, ECSDeploy
18
19
20
class TestECSClient(unittest.TestCase):
21
22
def setUp(self):
23
ecs_client = mock.Mock()
24
self.session = mock.Mock()
25
self.session.create_client.side_effect = ecs_client
26
27
# set global args
28
self.global_args = Namespace()
29
self.global_args.region = 'us-east-1'
30
self.global_args.endpoint_url = None
31
self.global_args.verify_ssl = None
32
33
def test_client_config(self):
34
self.test_client = ECSClient(
35
self.session, None, self.global_args, ECSDeploy.USER_AGENT_EXTRA)
36
37
expected_user_agent_extra = 'customization/ecs-deploy'
38
39
create_args = self.session.create_client.call_args
40
self.assertEqual(create_args[0][0], 'ecs')
41
self.assertEqual(
42
create_args[1]['region_name'], self.global_args.region)
43
self.assertEqual(create_args[1]['config'].user_agent_extra,
44
expected_user_agent_extra)
45
46