def integration_03_delete_stack(self): actor = cloudformation.Delete( 'Delete Stack', {'region': self.region, 'name': self.bucket_name}) done = yield actor.execute() self.assertEquals(done, None)
def test_execute_dry(self): actor = cloudformation.Delete( 'Unit Test Action', {'name': 'unit-test-cf', 'region': 'us-west-2'}, dry=True) actor._get_stack = mock.MagicMock(name='_get_stack') actor._get_stack.return_value = tornado_value(True) yield actor._execute()
def integration_04_delete_missing_stack_should_fail(self): actor = cloudformation.Delete('Delete Stack', { 'region': self.region, 'name': self.bucket_name }) with self.assertRaises(cloudformation.StackNotFound): yield actor.execute()
def test_execute_not_exists(self): actor = cloudformation.Delete('Unit Test Action', { 'name': 'unit-test-cf', 'region': 'us-west-2' }) actor._get_stack = mock.MagicMock(name='_get_stack') actor._get_stack.return_value = tornado_value(None) with self.assertRaises(cloudformation.StackNotFound): yield actor._execute()
def test_execute_dry(self): actor = cloudformation.Delete('Unit Test Action', { 'name': 'unit-test-cf', 'region': 'us-west-2' }, dry=True) actor._get_stack = mock.MagicMock() actor._get_stack.side_effect = [tornado_value(True)] yield actor._execute()
def test_delete_stack(self): actor = cloudformation.Delete('Unit Test Action', { 'name': 'unit-test-cf', 'region': 'us-west-2' }) actor.cf_conn.delete_stack = mock.MagicMock(name='delete_stack_mock') actor.cf_conn.delete_stack.return_value = 'req-id-1' ret = yield actor._delete_stack() self.assertEquals(ret, 'req-id-1')
def test_execute(self): actor = cloudformation.Delete('Unit Test Action', { 'name': 'unit-test-cf', 'region': 'us-west-2' }) actor._get_stack = mock.MagicMock(name='_get_stack') actor._get_stack.return_value = tornado_value(True) actor._delete_stack = mock.MagicMock(name='_delete_stack') actor._delete_stack.return_value = tornado_value(None) actor._wait_until_state = mock.MagicMock(name='_wait_until_state') actor._wait_until_state.side_effect = cloudformation.StackNotFound() yield actor._execute()
def test_delete_stack_raises_boto_error(self): actor = cloudformation.Delete('Unit Test Action', { 'name': 'unit-test-cf', 'region': 'us-west-2' }) actor.cf_conn.delete_stack = mock.MagicMock() actor.cf_conn.delete_stack.side_effect = BotoServerError( 400, 'Some error') with self.assertRaises(cloudformation.CloudFormationError): yield actor._delete_stack() actor.cf_conn.delete_stack.side_effect = BotoServerError( 500, 'Some unexpected failure') with self.assertRaises(BotoServerError): yield actor._delete_stack()