From b7356bc107a75d94b0500b87ab72dcb449585e9f Mon Sep 17 00:00:00 2001 From: pierrejeambrun Date: Thu, 30 Oct 2025 15:33:59 +0100 Subject: [PATCH] Add number of queries guard in public plugins list endpoints --- .../api_fastapi/core_api/routes/public/test_plugins.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_plugins.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_plugins.py index 17f20f6816bdc..2d77c4881b1d7 100644 --- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_plugins.py +++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_plugins.py @@ -20,6 +20,7 @@ import pytest +from tests_common.test_utils.asserts import assert_queries_count from tests_common.test_utils.markers import skip_if_force_lowest_dependencies_marker pytestmark = pytest.mark.db_test @@ -61,7 +62,8 @@ class TestGetPlugins: def test_should_respond_200( self, test_client, session, query_params, expected_total_entries, expected_names ): - response = test_client.get("/plugins", params=query_params) + with assert_queries_count(2): + response = test_client.get("/plugins", params=query_params) assert response.status_code == 200 body = response.json() @@ -69,7 +71,8 @@ def test_should_respond_200( assert [plugin["name"] for plugin in body["plugins"]] == expected_names def test_external_views_model_validator(self, test_client): - response = test_client.get("plugins") + with assert_queries_count(2): + response = test_client.get("plugins") body = response.json() test_plugin = next((plugin for plugin in body["plugins"] if plugin["name"] == "test_plugin"), None) @@ -163,7 +166,8 @@ class TestGetPluginImportErrors: new={"plugins/test_plugin.py": "something went wrong"}, ) def test_should_respond_200(self, test_client, session): - response = test_client.get("/plugins/importErrors") + with assert_queries_count(2): + response = test_client.get("/plugins/importErrors") assert response.status_code == 200 body = response.json()