def setUp(self): super(TestAbort, self).setUp() fileoperations.create_config_file('myEBCLItest', 'us-west-2', 'my-stack-stack') commonops.set_environment_for_current_branch('my-env') mockservice.enqueue('elasticbeanstalk', 'AbortEnvironmentUpdate', standard_abort())
def test_abort_provided(self): mockservice.enqueue('elasticbeanstalk', 'DescribeEnvironments', describe_env_all_abortable()) self.run_command('abort', 'bad-env') self.assertTrue( mockservice.called_with( 'elasticbeanstalk', 'AbortEnvironmentUpdate', { 'Action': u'AbortEnvironmentUpdate', 'EnvironmentName': 'bad-env', 'Version': u'2010-12-01' })) self.mock_input.assert_not_called()
def test_abort_multiple(self): mockservice.enqueue('elasticbeanstalk', 'DescribeEnvironments', describe_env_all_abortable()) self.run_command('abort') self.assertTrue( mockservice.called_with( 'elasticbeanstalk', 'AbortEnvironmentUpdate', { 'Action': u'AbortEnvironmentUpdate', 'EnvironmentName': 'single-env', 'Version': u'2010-12-01' })) self.mock_input.assert_called_with('(default is 1)', 1)
def test_abort_none(self): mockservice.enqueue('elasticbeanstalk', 'DescribeEnvironments', describe_env_none_abortable()) try: self.run_command('abort') self.fail('Should have thrown exception') except NotFoundError: pass self.assertEqual( len( mockservice.get_calls('elasticbeanstalk', 'AbortEnvironmentUpdate')), 0) self.mock_input.assert_not_called()
def test_abort_standard(self): mockservice.enqueue('elasticbeanstalk', 'DescribeEnvironments', describe_env_all_abortable()) self.run_command('abort')