You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Copilot (via GitHub)" <gi...@apache.org> on 2026/07/24 07:05:42 UTC

Re: [PR] Tidy DagVersion/DagCode metadata helpers [airflow]

Copilot commented on code in PR #68627:
URL: https://github.com/apache/airflow/pull/68627#discussion_r3643563829


##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_versions.py:
##########
@@ -177,20 +177,12 @@ def test_get_dag_version_with_url_template(self, test_client, dag_id, dag_versio
         assert response.json() == expected_response
 
     @pytest.mark.usefixtures("make_dag_with_multiple_versions")
-    @mock.patch("airflow.dag_processing.bundles.manager.DagBundlesManager.view_url")
-    @mock.patch("airflow.models.dag_version.hasattr")
-    def test_get_dag_version_with_unconfigured_bundle(
-        self, mock_hasattr, mock_view_url, test_client, dag_maker, session
-    ):
-        """Test that when a bundle is no longer configured, the bundle_url returns an error message."""
-        mock_hasattr.return_value = False
-        mock_view_url.side_effect = ValueError("Bundle not configured")
-
+    @mock.patch("airflow.models.dagbundle.DagBundleModel.render_url", return_value=None)
+    def test_get_dag_version_with_unconfigured_bundle(self, mock_render_url, test_client):
+        """A bundle row with no URL template yields an empty bundle_url."""
         response = test_client.get("/dags/dag_with_multiple_versions/dagVersions/1")
         assert response.status_code == 200
-
-        response_data = response.json()
-        assert not response_data["bundle_url"]
+        assert not response.json()["bundle_url"]

Review Comment:
   This test is meant to ensure that when a DagBundleModel row exists but has no URL template, we do *not* fall back to the deprecated DagBundlesManager.view_url() path. Currently it only asserts bundle_url is falsy; adding an explicit assert that view_url is not called makes the intent regression-proof (e.g. if the manager becomes unconfigured and would otherwise return None/raise ValueError, the test could still pass while hitting the deprecated path).



-- 
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