You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/06/01 01:19:28 UTC

[GitHub] [airflow] epapineau commented on a diff in pull request #22938: Enable dbt Cloud provider to interact with single tenant instances

epapineau commented on code in PR #22938:
URL: https://github.com/apache/airflow/pull/22938#discussion_r886245432


##########
tests/providers/dbt/cloud/hooks/test_dbt_cloud.py:
##########
@@ -119,16 +122,37 @@ def setup_class(self):
             password=TOKEN,
         )
 
+        # Connection with `schema` parameter set
+        schema_conn = Connection(
+            conn_id=SINGLE_TENANT_CONN,
+            conn_type=DbtCloudHook.conn_type,
+            login=DEFAULT_ACCOUNT_ID,
+            password=TOKEN,
+            schema=SINGLE_TENANT_SCHEMA,
+        )
+
         db.merge_conn(account_id_conn)
         db.merge_conn(no_account_id_conn)
+        db.merge_conn(schema_conn)
 
-    def test_init_hook(self):
-        hook = DbtCloudHook()
-        assert hook.dbt_cloud_conn_id == "dbt_cloud_default"
-        assert hook.base_url == BASE_URL
+    @pytest.mark.parametrize(
+        argnames="conn_id",
+        argvalues=[ACCOUNT_ID_CONN, SINGLE_TENANT_CONN],
+        ids=["multi-tenant", "single-tenant"],
+    )
+    def test_init_hook(self, conn_id):
+        hook = DbtCloudHook(conn_id)
         assert hook.auth_type == TokenAuth
         assert hook.method == "POST"
 
+        if conn_id == ACCOUNT_ID_CONN:
+            assert hook.dbt_cloud_conn_id == ACCOUNT_ID_CONN
+            assert hook.base_url == BASE_URL
+
+        if conn_id == SINGLE_TENANT_CONN:
+            assert hook.dbt_cloud_conn_id == SINGLE_TENANT_CONN
+            assert hook.base_url == SINGLE_TENANT_URL

Review Comment:
   Much better, thanks!



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org