Path: blob/develop/tests/unit/customizations/cloudtrail/test_commands.py
1569 views
# Copyright 2015 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 mock, unittest13from awscli.customizations import cloudtrail1415class TestCloudTrailPlumbing(unittest.TestCase):16def test_initialization_registers_injector(self):17cli = mock.Mock()18cloudtrail.initialize(cli)19cli.register.assert_called_with('building-command-table.cloudtrail',20cloudtrail.inject_commands)2122def test_injection_adds_two_commands_to_cmd_table(self):23command_table = {}24session = mock.Mock()25cloudtrail.inject_commands(command_table, session)26self.assertIn('create-subscription', command_table)27self.assertIn('update-subscription', command_table)28self.assertIn('validate-logs', command_table)293031