jason810496 commented on code in PR #55082:
URL: https://github.com/apache/airflow/pull/55082#discussion_r2320691888
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_grid.py:
##########
@@ -494,6 +496,54 @@ def test_get_grid_runs(self, session, test_client):
},
]
+ def test_get_grid_runs_filter_by_run_type_scheduled(self, session,
test_client):
+ session.commit()
+ response = test_client.get(f"/grid/runs/{DAG_ID}?run_type=scheduled")
+ assert response.status_code == 200
+ assert response.json() == [GRID_RUN_1]
+
+ def test_get_grid_runs_filter_by_run_type_manual(self, session,
test_client):
+ session.commit()
+ response = test_client.get(f"/grid/runs/{DAG_ID}?run_type=manual")
+ assert response.status_code == 200
+ assert response.json() == [GRID_RUN_2]
+
+ def test_get_dag_structure_filter_by_run_type_scheduled(self, session,
test_client):
+ session.commit()
+ response =
test_client.get(f"/grid/structure/{DAG_ID}?run_type=scheduled")
+ assert response.status_code == 200
+ assert response.json() == GRID_NODES
+
+ def test_get_dag_structure_filter_by_run_type_manual(self, session,
test_client):
+ session.commit()
+ response = test_client.get(f"/grid/structure/{DAG_ID}?run_type=manual")
+ assert response.status_code == 200
+ assert response.json() == GRID_NODES
+
+ def test_get_grid_runs_filter_by_triggering_user(self, session,
test_client):
+ session.commit()
+ response =
test_client.get(f"/grid/runs/{DAG_ID}?triggering_user=user2")
+ assert response.status_code == 200
+ assert response.json() == [GRID_RUN_2]
+
+ def test_get_grid_runs_filter_by_triggering_user_nonexistent(self,
session, test_client):
+ session.commit()
+ response =
test_client.get(f"/grid/runs/{DAG_ID}?triggering_user=nonexistent")
+ assert response.status_code == 200
+ assert response.json() == []
+
+ def test_get_dag_structure_filter_by_triggering_user(self, session,
test_client):
+ session.commit()
+ response =
test_client.get(f"/grid/structure/{DAG_ID}?triggering_user=user2")
+ assert response.status_code == 200
+ assert response.json() == GRID_NODES
+
+ def test_get_grid_runs_filter_by_run_type_and_triggering_user(self,
session, test_client):
+ session.commit()
+ response =
test_client.get(f"/grid/runs/{DAG_ID}?run_type=manual&triggering_user=user2")
+ assert response.status_code == 200
+ assert response.json() == [GRID_RUN_2]
+
Review Comment:
Would it be better to consolidate all these test cases with `parameterize` ?
--
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]