Skip to content

Commit e4f9fef

Browse files
Add number of queries guard for ui calendar (#58044)
1 parent f578997 commit e4f9fef

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_calendar.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from airflow.utils.session import provide_session
2626
from airflow.utils.state import DagRunState
2727

28+
from tests_common.test_utils.asserts import assert_queries_count
2829
from tests_common.test_utils.db import clear_db_dags, clear_db_runs
2930

3031
pytestmark = pytest.mark.db_test
@@ -103,7 +104,8 @@ def teardown_method(self) -> None:
103104
],
104105
)
105106
def test_daily_calendar(self, test_client, query_params, result):
106-
response = test_client.get(f"/calendar/{self.DAG_NAME}", params=query_params)
107+
with assert_queries_count(4):
108+
response = test_client.get(f"/calendar/{self.DAG_NAME}", params=query_params)
107109
assert response.status_code == 200
108110
body = response.json()
109111
print(body)
@@ -173,7 +175,8 @@ def test_daily_calendar(self, test_client, query_params, result):
173175
],
174176
)
175177
def test_hourly_calendar(self, setup_dag_runs, test_client, query_params, result):
176-
response = test_client.get(f"/calendar/{self.DAG_NAME}", params=query_params)
178+
with assert_queries_count(4):
179+
response = test_client.get(f"/calendar/{self.DAG_NAME}", params=query_params)
177180
assert response.status_code == 200
178181
body = response.json()
179182

0 commit comments

Comments
 (0)