david30907d commented on a change in pull request #19508:
URL: https://github.com/apache/airflow/pull/19508#discussion_r777094467
##########
File path: tests/providers/google/cloud/hooks/test_bigquery.py
##########
@@ -1837,3 +1843,40 @@ def test_create_external_table_description(self,
mock_create):
_, kwargs = mock_create.call_args
assert kwargs['table_resource']['description'] is description
+
+
+class TestConnection(unittest.TestCase):
+ def setUp(self):
+ crypto._fernet = None
+ patcher = mock.patch('airflow.models.connection.mask_secret',
autospec=True)
+ self.mask_secret = patcher.start()
+
+ self.addCleanup(patcher.stop)
+
+ def tearDown(self):
+ crypto._fernet = None
+ @mock.patch.dict(
+ 'os.environ',
+ {
+ 'AIRFLOW_CONN_TEST_URI':
'google-cloud-platform://?__extra__=%7B%22extra__google_cloud_platform__key_path%22%3A+%22%2Fopt%2FYOUR_FILE_PATH%2Fservice-account.json%22%2C+%22extra__google_cloud_platform__keyfile_dict%22%3A+%22%22%2C+%22extra__google_cloud_platform__num_retries%22%3A+5%2C+%22extra__google_cloud_platform__project%22%3A+%22YOUR_GCP_PROJECT%22%2C+%22extra__google_cloud_platform__scope%22%3A+%22https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform%22%7D',
+ },
+ )
+ def test_dbapi_get_uri(self):
+ conn = BaseHook.get_connection(conn_id='test_uri')
+ hook = conn.get_hook()
+ assert 'bigquery://' == hook.get_uri()
Review comment:
yea make sense, thx @kazanzhy for reviewing~
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]