TobKed commented on a change in pull request #6780: [AIRFLOW-4899] Fix BQ Hook
- get_datasets_list uses pagination (#6780)
URL: https://github.com/apache/airflow/pull/6780#discussion_r356442431
##########
File path: tests/gcp/hooks/test_bigquery.py
##########
@@ -795,18 +795,48 @@ def test_get_datasets_list(self):
"datasetId": "dataset_1_test"
}
}
- ]}
- project_id = "project_test"''
+ ]
+ project_id = "project_test"
- mocked = mock.Mock()
- with mock.patch.object(hook.BigQueryBaseCursor(mocked,
project_id).service,
- 'datasets') as MockService:
- MockService.return_value.list(
- projectId=project_id).execute.return_value = expected_result
- result = hook.BigQueryBaseCursor(
- mocked, "test_create_empty_dataset").get_datasets_list(
- project_id=project_id)
- self.assertEqual(result, expected_result['datasets'])
+ mock_service = mock.Mock()
+ cursor = hook.BigQueryBaseCursor(mock_service, project_id)
+
mock_service.datasets.return_value.list.return_value.execute.return_value = {
Review comment:
I think you could check here by using `assert_called_once_with` with what
parameters list method was called.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services