kaxil commented on code in PR #61675:
URL: https://github.com/apache/airflow/pull/61675#discussion_r2784522274


##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dag_versions.py:
##########
@@ -316,6 +316,23 @@ def test_get_dag_versions(
         assert response.status_code == 200
         assert response.json() == expected_response
 
+    @pytest.mark.usefixtures("make_dag_with_multiple_versions")
+    @mock.patch(
+        
"airflow.api_fastapi.auth.managers.base_auth_manager.BaseAuthManager.get_authorized_dag_ids",
+        return_value=[("dag_with_multiple_versions")],
+    )
+    def test_get_dag_versions_permission_filtering(self, _, test_client):
+        """
+        Test that the endpoint correctly filters DAG versions based on user 
permissions.
+
+        Here the user do not have permission on the ANOTHER_DAG_ID dag.
+        """
+        with assert_queries_count(4):
+            response = test_client.get("/dags/~/dagVersions")
+
+        assert response.status_code == 200
+        assert response.json()["total_entries"] == 3

Review Comment:
   Same as yours but just a couple more checks at the end



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

Reply via email to