@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_service')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryCursor.flush_results')
def test_next_no_rows(self, mock_flush_results, mock_get_service):
    mock_get_query_results = mock_get_service.return_value.jobs.return_value.getQueryResults
    mock_execute = mock_get_query_results.return_value.execute
    mock_execute.return_value = {}
    bq_cursor = self.hook.get_cursor()
    bq_cursor.job_id = JOB_ID
    result = bq_cursor.next()
    assert (result is None)
    mock_get_query_results.assert_called_once_with(jobId=JOB_ID, location=None, pageToken=None, projectId='bq-project')
    mock_execute.assert_called_once_with(num_retries=bq_cursor.num_retries)
    assert (mock_flush_results.call_count == 1)
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_service')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryCursor.flush_results')
def test_next_no_rows(self, mock_flush_results, mock_get_service):
    mock_get_query_results = mock_get_service.return_value.jobs.return_value.getQueryResults
    mock_execute = mock_get_query_results.return_value.execute
    mock_execute.return_value = {}
    bq_cursor = self.hook.get_cursor()
    bq_cursor.job_id = JOB_ID
    result = bq_cursor.next()
    assert (result is None)
    mock_get_query_results.assert_called_once_with(jobId=JOB_ID, location=None, pageToken=None, projectId='bq-project')
    mock_execute.assert_called_once_with(num_retries=bq_cursor.num_retries)
    assert (mock_flush_results.call_count == 1)