def test_execute(self, mock_hook): operator = StackdriverListAlertPoliciesOperator(task_id=TEST_TASK_ID, filter_=TEST_FILTER) operator.execute(None) mock_hook.return_value.list_alert_policies.assert_called_once_with( project_id=None, filter_=TEST_FILTER, format_=None, order_by=None, page_size=None, retry=DEFAULT, timeout=DEFAULT, metadata=None, )
def test_execute(self, mock_hook): operator = StackdriverListAlertPoliciesOperator(task_id=TEST_TASK_ID, filter_=TEST_FILTER) mock_hook.return_value.list_alert_policies.return_value = [ AlertPolicy(name="test-name") ] result = operator.execute(None) mock_hook.return_value.list_alert_policies.assert_called_once_with( project_id=None, filter_=TEST_FILTER, format_=None, order_by=None, page_size=None, retry=DEFAULT, timeout=DEFAULT, metadata=None, ) assert [{ 'combiner': 0, 'conditions': [], 'display_name': '', 'name': 'test-name', 'notification_channels': [], 'user_labels': {}, }] == result