feluelle commented on a change in pull request #6180: [AIRFLOW-5549] Extended
BQ GetDataOperator to handle query params
URL: https://github.com/apache/airflow/pull/6180#discussion_r329080193
##########
File path: tests/gcp/hooks/test_bigquery.py
##########
@@ -460,6 +460,49 @@ def test_insert_all_fail(self):
cursor.insert_all(project_id, dataset_id, table_id,
rows, fail_on_error=True)
+ def test_get_data(self):
+ expected_result = {
+ "kind": "bigquery#tableDataList",
+ "etag": "QB24gaarZFqaiu5jRyPiA==",
+ "totalRows": "30",
+ "pageToken": "BHSHJT3DRAFSSIAICAFCACSB77777777757SUAA=",
+ "rows": [
+ {
+ "f": [
+ {
+ "v": "219067803"
+ },
+ {
+ "v": "10000"
+ },
+ {
+ "v": "2019-01-09"
+ },
+ {
+ "v": "2019-01-11"
+ },
+ {
+ "v": "1565783983.395962"
+ }
+ ]
+ }
+ ]
+ }
+
+ project_id = 'your-project'
+ dataset_id = 'your_dataset'
+ table_id = 'table'
+
+ mock_service = mock.Mock()
+ with mock.patch.object(hook.BigQueryBaseCursor(mock_service,
project_id).service,
Review comment:
I don't know if you know, but you can also use the `@mock.patch.object`
decorator/annotation. I like it more especially when basically your whole test
is using the mock object.
I think it also reduces the _clutter_ in tests.
----------------------------------------------------------------
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