def test_add_exception(self): actor = elbv2_actor.RegisterInstance('UTA', { 'target_group': 'test', 'region': 'us-east-1', 'instances': 'test'}) actor.elbv2_conn = mock.Mock() exc = botocore.exceptions.ClientError({'Error': {'Code': ''}}, 'Test') actor.elbv2_conn.register_targets.side_effect = exc with self.assertRaises(exceptions.UnrecoverableActorFailure): yield actor._add('target_group_arn', ['i-un173s7'])
def test_execute(self): actor = elbv2_actor.RegisterInstance('UTA', { 'target_group': 'test', 'region': 'us-east-1', 'instances': 'i-test'}) actor._find_target_group = mock.Mock() actor._find_target_group.return_value = helper.tornado_value('arn') actor._add = mock.Mock() actor._add.return_value = helper.tornado_value(mock.Mock()) yield actor._execute() actor._add.assert_called_with('arn', ['i-test'])
def test_execute_self(self): # No instance id specified actor = elbv2_actor.RegisterInstance('UTA', { 'target_group': 'test', 'region': 'us-east-1'}) actor._find_target_group = mock.Mock() actor._find_target_group.return_value = helper.tornado_value('arn') actor._add = mock.Mock() actor._get_meta_data = helper.mock_tornado('i-test') actor._add.return_value = helper.tornado_value(mock.Mock()) yield actor._execute() actor._add.assert_called_with('arn', ['i-test'])
def test_add(self): actor = elbv2_actor.RegisterInstance('UTA', { 'target_group': 'test', 'region': 'us-east-1', 'instances': 'test'}) actor.elbv2_conn = mock.Mock() actor.elbv2_conn.register_targets.return_value = {} yield actor._add('target_group_arn', ['i-un173s7']) actor.elbv2_conn.register_targets.assert_called_with( TargetGroupArn='target_group_arn', Targets=[{'Id': 'i-un173s7'}])