@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_client')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.poll_job_complete')
@mock.patch('time.sleep')
@mock.patch('logging.Logger.info')
def test_cancel_query_cancel_completed(self, mock_logger_info, mock_sleep, poll_job_complete, mock_client):
    poll_job_complete.side_effect = (([False] * 12) + [True])
    self.hook.running_job_id = JOB_ID
    self.hook.cancel_query()
    mock_client.return_value.cancel_job.assert_called_once_with(job_id=JOB_ID)
    assert (poll_job_complete.call_count == 13)
    assert (mock_sleep.call_count == 11)
    mock_logger_info.has_call(mock.call(f'Job successfully canceled: {PROJECT_ID}, {PROJECT_ID}'))
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_client')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.poll_job_complete')
@mock.patch('time.sleep')
@mock.patch('logging.Logger.info')
def test_cancel_query_cancel_completed(self, mock_logger_info, mock_sleep, poll_job_complete, mock_client):
    poll_job_complete.side_effect = (([False] * 12) + [True])
    self.hook.running_job_id = JOB_ID
    self.hook.cancel_query()
    mock_client.return_value.cancel_job.assert_called_once_with(job_id=JOB_ID)
    assert (poll_job_complete.call_count == 13)
    assert (mock_sleep.call_count == 11)
    mock_logger_info.has_call(mock.call(f'Job successfully canceled: {PROJECT_ID}, {PROJECT_ID}'))