mik-laj commented on a change in pull request #9045:
URL: https://github.com/apache/airflow/pull/9045#discussion_r451462807
##########
File path: tests/api_connexion/endpoints/test_dag_endpoint.py
##########
@@ -133,11 +163,101 @@ def test_should_response_200_serialized(self):
class TestGetDags(TestDagEndpoint):
- @pytest.mark.skip(reason="Not implemented yet")
+
def test_should_response_200(self):
- response = self.client.get("/api/v1/dags/1")
+ self._create_dag_models(2)
+
+ response = self.client.get("api/v1/dags")
+
+ assert response.status_code == 200
+
+ self.assertEqual(
+ {
+ "dags": [
+ {
+ "dag_id": "TEST_DAG_1",
+ "description": None,
+ "fileloc": "/tmp/dag_1.py",
+ "is_paused": False,
+ "is_subdag": False,
+ "owners": [],
+ "root_dag_id": None,
+ "schedule_interval": {"__type": "CronExpression",
"value": "2 2 * * *"},
+ "tags": [],
+ },
+ {
+ "dag_id": "TEST_DAG_2",
+ "description": None,
+ "fileloc": "/tmp/dag_2.py",
+ "is_paused": False,
+ "is_subdag": False,
+ "owners": [],
+ "root_dag_id": None,
+ "schedule_interval": {"__type": "CronExpression",
"value": "2 2 * * *"},
+ "tags": [],
+ },
+ ],
+ "total_entries": 2,
+ },
+ response.json,
+ )
+
+ @parameterized.expand(
+ [
+ ("api/v1/dags?limit=1", ["TEST_DAG_1"]),
+ ("api/v1/dags?limit=2", ["TEST_DAG_1", "TEST_DAG_10"]),
+ (
+ "api/v1/dags?offset=5",
+ [
+ "TEST_DAG_5",
+ "TEST_DAG_6",
+ "TEST_DAG_7",
+ "TEST_DAG_8",
+ "TEST_DAG_9",
+ ],
+ ),
+ (
+ "api/v1/dags?offset=0",
+ [
+ "TEST_DAG_1",
+ "TEST_DAG_10",
+ "TEST_DAG_2",
+ "TEST_DAG_3",
Review comment:
The data is sorted.
```
.order_by(DagModel.dag_id)
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]