@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.update_table')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_dataset_tables')
def test_table_upsert_already_exists(self, mock_get, mock_update):
    table_resource = {'tableReference': {'tableId': TABLE_ID}}
    mock_get.return_value = [{'tableId': TABLE_ID}]
    self.hook.run_table_upsert(dataset_id=DATASET_ID, table_resource=table_resource)
    mock_get.assert_called_once_with(project_id=PROJECT_ID, dataset_id=DATASET_ID)
    mock_update.assert_called_once_with(table_resource=table_resource)
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.update_table')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_dataset_tables')
def test_table_upsert_already_exists(self, mock_get, mock_update):
    table_resource = {'tableReference': {'tableId': TABLE_ID}}
    mock_get.return_value = [{'tableId': TABLE_ID}]
    self.hook.run_table_upsert(dataset_id=DATASET_ID, table_resource=table_resource)
    mock_get.assert_called_once_with(project_id=PROJECT_ID, dataset_id=DATASET_ID)
    mock_update.assert_called_once_with(table_resource=table_resource)