Path: blob/develop/tests/unit/customizations/emr/__init__.py
1569 views
# Copyright 2014 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 awscli.customizations.emr import exceptions14from awscli.customizations.emr.configutils import ConfigWriter15from awscli.customizations.preview import mark_as_preview16from awscli.testutils import BaseAWSCommandParamsTest17from awscli.testutils import mock1819class EMRBaseAWSCommandParamsTest(BaseAWSCommandParamsTest):2021def setUp(self):22super(EMRBaseAWSCommandParamsTest, self).setUp()2324# Do not use any emr-specific configs for the test cases25self.get_scoped_config_mock = mock.Mock()26self.set_configs({})2728# Do not write or update the config (~/.aws/config) file29self.patcher_update_config = mock.patch(30'awscli.customizations.emr.configutils.ConfigWriter.update_config')31self.mock_update_config = self.patcher_update_config.start()3233def set_configs(self, configs):34self.driver.session.get_scoped_config = self.get_scoped_config_mock35self.get_scoped_config_mock.return_value = {'emr': configs}3637def tearDown(self):38super(EMRBaseAWSCommandParamsTest, self).tearDown()39self.patcher_update_config.stop()4041def assert_error_msg(self, cmd,42exception_class_name, error_msg_kwargs={}):43exception_class = getattr(exceptions, exception_class_name)44error_msg = "\n%s\n" % exception_class.fmt.format(**error_msg_kwargs)45result = self.run_cmd(cmd, 255)46self.assertEqual(error_msg, result[1])474849