Skip to content

Commit

Permalink
Fix BigQueryDataTransferServiceHook.get_transfer_run() request parame…
Browse files Browse the repository at this point in the history
…ter (#21293)
  • Loading branch information
zaimy committed Feb 8, 2022
1 parent 471e368 commit 34d63fa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion airflow/providers/google/cloud/hooks/bigquery_dts.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ def get_transfer_run(
if self.location:
project = f"{project}/locations/{self.location}"

name = "f{project}/transferConfigs/{transfer_config_id}/runs/{run_id}"
name = f"{project}/transferConfigs/{transfer_config_id}/runs/{run_id}"
return client.get_transfer_run(
request={'name': name}, retry=retry, timeout=timeout, metadata=metadata or ()
)
12 changes: 12 additions & 0 deletions tests/providers/google/cloud/hooks/test_bigquery_dts.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
)

TRANSFER_CONFIG_ID = "id1234"
RUN_ID = "id1234"


class BigQueryDataTransferHookTestCase(unittest.TestCase):
Expand Down Expand Up @@ -106,3 +107,14 @@ def test_start_manual_transfer_runs(self, service_mock):
retry=None,
timeout=None,
)

@mock.patch(
"airflow.providers.google.cloud.hooks.bigquery_dts.DataTransferServiceClient.get_transfer_run"
)
def test_get_transfer_run(self, service_mock):
self.hook.get_transfer_run(
run_id=RUN_ID, transfer_config_id=TRANSFER_CONFIG_ID, project_id=PROJECT_ID
)

name = f"projects/{PROJECT_ID}/transferConfigs/{TRANSFER_CONFIG_ID}/runs/{RUN_ID}"
service_mock.assert_called_once_with(request=dict(name=name), metadata=(), retry=None, timeout=None)

0 comments on commit 34d63fa

Please sign in to comment.