def setUp(self): self.region = 'us-east-1' self.system_patcher = patch('platform.system') self.system = self.system_patcher.start() self.system.return_value = 'Linux' self.linux_distribution_patcher = patch( 'awscli.compat.linux_distribution') self.linux_distribution = self.linux_distribution_patcher.start() self.linux_distribution.return_value = ('Ubuntu', '', '') self.urlopen_patcher = patch( 'awscli.customizations.codedeploy.utils.urlopen') self.urlopen = self.urlopen_patcher.start() self.urlopen.side_effect = timeout('Not EC2 instance') self.geteuid_patcher = patch('os.geteuid', create=True) self.geteuid = self.geteuid_patcher.start() self.geteuid.return_value = 0 self.remove_patcher = patch('os.remove') self.remove = self.remove_patcher.start() self.args = Namespace() self.globals = Namespace() self.globals.region = self.region self.session = MagicMock() self.uninstall = Uninstall(self.session)
def inject_commands(command_table, session, **kwargs): """ Inject custom 'aws deploy' commands. """ command_table['push'] = Push(session) command_table['register'] = Register(session) command_table['deregister'] = Deregister(session) command_table['install'] = Install(session) command_table['uninstall'] = Uninstall(session)