@parameterized.expand([(['ALLOW_FIELD_ADDITION'], 'WRITE_APPEND'), (['ALLOW_FIELD_RELAXATION'], 'WRITE_APPEND'), (['ALLOW_FIELD_ADDITION', 'ALLOW_FIELD_RELAXATION'], 'WRITE_APPEND'), (['ALLOW_FIELD_ADDITION'], 'WRITE_TRUNCATE'), (['ALLOW_FIELD_RELAXATION'], 'WRITE_TRUNCATE'), (['ALLOW_FIELD_ADDITION', 'ALLOW_FIELD_RELAXATION'], 'WRITE_TRUNCATE')])
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_service')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.insert_job')
def test_run_query_schema_update_options(self, schema_update_options, write_disposition, mock_insert, mock_get_service):
    self.hook.run_query(sql='query', destination_dataset_table='my_dataset.my_table', schema_update_options=schema_update_options, write_disposition=write_disposition)
    (_, kwargs) = mock_insert.call_args
    assert (kwargs['configuration']['query']['schemaUpdateOptions'] == schema_update_options)
    assert (kwargs['configuration']['query']['writeDisposition'] == write_disposition)
@parameterized.expand([(['ALLOW_FIELD_ADDITION'], 'WRITE_APPEND'), (['ALLOW_FIELD_RELAXATION'], 'WRITE_APPEND'), (['ALLOW_FIELD_ADDITION', 'ALLOW_FIELD_RELAXATION'], 'WRITE_APPEND'), (['ALLOW_FIELD_ADDITION'], 'WRITE_TRUNCATE'), (['ALLOW_FIELD_RELAXATION'], 'WRITE_TRUNCATE'), (['ALLOW_FIELD_ADDITION', 'ALLOW_FIELD_RELAXATION'], 'WRITE_TRUNCATE')])
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.get_service')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.BigQueryHook.insert_job')
def test_run_query_schema_update_options(self, schema_update_options, write_disposition, mock_insert, mock_get_service):
    self.hook.run_query(sql='query', destination_dataset_table='my_dataset.my_table', schema_update_options=schema_update_options, write_disposition=write_disposition)
    (_, kwargs) = mock_insert.call_args
    assert (kwargs['configuration']['query']['schemaUpdateOptions'] == schema_update_options)
    assert (kwargs['configuration']['query']['writeDisposition'] == write_disposition)