def test_cloudwatch_remove_rule_targets(aws_client): client = MagicMock() aws_client.return_value = client rule_name = 'my-rule' target_ids = ['1', '2', '3'] remove_rule_targets(rule_name, target_ids) client.remove_targets.assert_called_with(Rule=rule_name, Ids=target_ids)
def test_cloudwatch_remove_rule_targets(aws_client): client = MagicMock() aws_client.return_value = client rule_name = "my-rule" target_ids = ["1", "2", "3"] remove_rule_targets(rule_name, target_ids) client.remove_targets.assert_called_with(Rule=rule_name, Ids=target_ids)
def test_cloudwatch_remove_rule_targets_all(aws_client): client = MagicMock() aws_client.return_value = client rule_name = 'my-rule' target_ids = ['1', '2', '3'] client.list_targets_by_rule.return_value = { 'Targets': [{'Id': t} for t in target_ids] } remove_rule_targets(rule_name, target_ids=None) client.remove_targets.assert_called_with(Rule=rule_name, Ids=target_ids) client.list_targets_by_rule.assert_called_with(Rule=rule_name) client.remove_targets.assert_called_with(Rule=rule_name, Ids=target_ids)
def test_cloudwatch_remove_rule_targets_all(aws_client): client = MagicMock() aws_client.return_value = client rule_name = "my-rule" target_ids = ["1", "2", "3"] client.list_targets_by_rule.return_value = { "Targets": [{ "Id": t } for t in target_ids] } remove_rule_targets(rule_name, target_ids=None) client.remove_targets.assert_called_with(Rule=rule_name, Ids=target_ids) client.list_targets_by_rule.assert_called_with(Rule=rule_name) client.remove_targets.assert_called_with(Rule=rule_name, Ids=target_ids)