@mock.patch('airflow.providers.google.cloud.hooks.bigquery.Table')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.Client')
def test_create_empty_table_with_extras_succeed(self, mock_bq_client, mock_table):
    schema_fields = [{'name': 'id', 'type': 'STRING', 'mode': 'REQUIRED'}, {'name': 'name', 'type': 'STRING', 'mode': 'NULLABLE'}, {'name': 'created', 'type': 'DATE', 'mode': 'REQUIRED'}]
    time_partitioning = {'field': 'created', 'type': 'DAY'}
    cluster_fields = ['name']
    self.hook.create_empty_table(project_id=PROJECT_ID, dataset_id=DATASET_ID, table_id=TABLE_ID, schema_fields=schema_fields, time_partitioning=time_partitioning, cluster_fields=cluster_fields)
    body = {'tableReference': {'tableId': TABLE_ID, 'projectId': PROJECT_ID, 'datasetId': DATASET_ID}, 'schema': {'fields': schema_fields}, 'timePartitioning': time_partitioning, 'clustering': {'fields': cluster_fields}}
    mock_table.from_api_repr.assert_called_once_with(body)
    mock_bq_client.return_value.create_table.assert_called_once_with(table=mock_table.from_api_repr.return_value, exists_ok=True, retry=DEFAULT_RETRY)
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.Table')
@mock.patch('airflow.providers.google.cloud.hooks.bigquery.Client')
def test_create_empty_table_with_extras_succeed(self, mock_bq_client, mock_table):
    schema_fields = [{'name': 'id', 'type': 'STRING', 'mode': 'REQUIRED'}, {'name': 'name', 'type': 'STRING', 'mode': 'NULLABLE'}, {'name': 'created', 'type': 'DATE', 'mode': 'REQUIRED'}]
    time_partitioning = {'field': 'created', 'type': 'DAY'}
    cluster_fields = ['name']
    self.hook.create_empty_table(project_id=PROJECT_ID, dataset_id=DATASET_ID, table_id=TABLE_ID, schema_fields=schema_fields, time_partitioning=time_partitioning, cluster_fields=cluster_fields)
    body = {'tableReference': {'tableId': TABLE_ID, 'projectId': PROJECT_ID, 'datasetId': DATASET_ID}, 'schema': {'fields': schema_fields}, 'timePartitioning': time_partitioning, 'clustering': {'fields': cluster_fields}}
    mock_table.from_api_repr.assert_called_once_with(body)
    mock_bq_client.return_value.create_table.assert_called_once_with(table=mock_table.from_api_repr.return_value, exists_ok=True, retry=DEFAULT_RETRY)