pierrejeambrun commented on code in PR #54563:
URL: https://github.com/apache/airflow/pull/54563#discussion_r2318364251
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_dags.py:
##########
@@ -490,6 +490,28 @@ def test_get_dags_should_response_403(self,
unauthorized_test_client):
response = unauthorized_test_client.get("/dags")
assert response.status_code == 403
+ def test_get_dags_filter_has_import_errors_true(self, session,
test_client):
+ dag = session.get(DagModel, DAG1_ID)
+ dag.has_import_errors = True
+ session.commit()
+
+ response = test_client.get("/dags", params={"has_import_errors": True})
+ assert response.status_code == 200
+ body = response.json()
+ assert body["total_entries"] == 1
+ assert [dag["dag_id"] for dag in body["dags"]] == [DAG1_ID]
+
+ def test_get_dags_filter_has_import_errors_false(self, session,
test_client):
+ dag = session.get(DagModel, DAG1_ID)
+ dag.has_import_errors = True
+ session.commit()
+
+ response = test_client.get("/dags", params={"has_import_errors":
False})
+ assert response.status_code == 200
+ body = response.json()
+ assert body["total_entries"] == 1
+ assert [dag["dag_id"] for dag in body["dags"]] == [DAG2_ID]
Review Comment:
nit: cat you use `pytest.mark.parametrize` to merge those two tests. They
are very similar.
--
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]