def test_execute(self, mock_hook): operator = StackdriverListNotificationChannelsOperator(task_id=TEST_TASK_ID, filter_=TEST_FILTER) operator.execute(None) mock_hook.return_value.list_notification_channels.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 = StackdriverListNotificationChannelsOperator(task_id=TEST_TASK_ID, filter_=TEST_FILTER) mock_hook.return_value.list_notification_channels.return_value = [ NotificationChannel(name="test-123") ] result = operator.execute(None) mock_hook.return_value.list_notification_channels.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 [ { 'description': '', 'display_name': '', 'labels': {}, 'name': 'test-123', 'type_': '', 'user_labels': {}, 'verification_status': 0, } ] == result
def test_execute(self, mock_hook): operator = StackdriverListNotificationChannelsOperator( task_id=TEST_TASK_ID, filter_=TEST_FILTER) mock_hook.return_value.list_notification_channels.return_value = [ NotificationChannel(name="test-123") ] result = operator.execute(None) mock_hook.return_value.list_notification_channels.assert_called_once_with( project_id=None, filter_=TEST_FILTER, format_=None, order_by=None, page_size=None, retry=DEFAULT, timeout=DEFAULT, metadata=None, ) # Depending on the version of google-apitools installed we might receive the response either with or # without mutation_records. assert result in [ [{ 'description': '', 'display_name': '', 'labels': {}, 'name': 'test-123', 'type_': '', 'user_labels': {}, 'verification_status': 0, }], [{ 'description': '', 'display_name': '', 'labels': {}, 'mutation_records': [], 'name': 'test-123', 'type_': '', 'user_labels': {}, 'verification_status': 0, }], ]