Skip to content

Commit

Permalink
added test for dag_id_pattern_required
Browse files Browse the repository at this point in the history
  • Loading branch information
megan-parker committed Mar 10, 2022
1 parent 00f3a80 commit 2ee1ee9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion airflow/api_connexion/openapi/v1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ paths:
description: >
Update DAGs of a given dag_id_pattern using UpdateMask.
This endpoint allows specifying `~` as the dag_id_pattern to retrieve DAG runs for all DAGs.
This endpoint allows specifying `~` as the dag_id_pattern to update all DAGs.
*New in version 2.3.0*
x-openapi-router-controller: airflow.api_connexion.endpoints.dag_endpoint
Expand Down
11 changes: 11 additions & 0 deletions tests/api_connexion/endpoints/test_dag_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,3 +1246,14 @@ def test_should_respond_200_and_pause_dag_pattern(self, session):
assert len(dags_not_updated.all()) == 8
dags_updated = session.query(DagModel).filter(DagModel.is_paused)
assert len(dags_updated.all()) == 2

def test_should_respons_400_dag_id_pattern_missing(self):
self._create_dag_models(1)
response = self.client.patch(
"/api/v1/dags?only_active=True",
json={
"is_paused": False,
},
environ_overrides={'REMOTE_USER': "test"},
)
assert response.status_code == 400

0 comments on commit 2ee1ee9

Please sign in to comment.