@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_service')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.insert_job')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryCursor.flush_results')
def test_flush_cursor_in_execute(self, _, mock_insert, mock_get_service):
    bq_cursor = self.hook.get_cursor()
    bq_cursor.execute('SELECT %(foo)s', {'foo': 'bar'})
    assert (mock_insert.call_count == 1)
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_service')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.insert_job')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryCursor.flush_results')
def test_flush_cursor_in_execute(self, _, mock_insert, mock_get_service):
    bq_cursor = self.hook.get_cursor()
    bq_cursor.execute('SELECT %(foo)s', {'foo': 'bar'})
    assert (mock_insert.call_count == 1)