Path: blob/develop/tests/unit/customizations/emr/test_command.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.12from awscli.testutils import mock1314from tests.unit.customizations.emr import EMRBaseAWSCommandParamsTest as \15BaseAWSCommandParamsTest16import argparse17from awscli.customizations.emr.command import Command181920class FakeCommand(Command):2122def _run_main_command(self, parsed_args, parsed_globals):23return 0242526class TestCommand(BaseAWSCommandParamsTest):2728def test_region(self):29def mock_region_side_effect(*args, **kwargs):30if args[0] == 'region':31return 'eu-central-1'32else:33return None3435mock_session = mock.Mock()36mock_session.get_config_variable.side_effect = mock_region_side_effect37mock_session.get_scoped_config.return_value = {}38parsed_globals = argparse.Namespace()39parsed_globals.region = None40mocked_parsed_args = mock.Mock()4142cmd = FakeCommand(mock_session)43cmd._run_main(mocked_parsed_args, parsed_globals)4445self.assertEqual(cmd.region, 'eu-central-1')464748