pierrejeambrun commented on code in PR #42782:
URL: https://github.com/apache/airflow/pull/42782#discussion_r1801253478


##########
tests/api_fastapi/views/public/test_connections.py:
##########
@@ -100,6 +113,73 @@ def test_get_should_respond_200_with_extra_redacted(self, 
test_client, session):
         response = test_client.get(f"/public/connections/{TEST_CONN_ID}")
         assert response.status_code == 200
         body = response.json()
-        assert body["conn_id"] == TEST_CONN_ID
+        assert body["connection_id"] == TEST_CONN_ID
         assert body["conn_type"] == TEST_CONN_TYPE
         assert body["extra"] == '{"password": "***"}'
+
+
+class TestGetConnections(TestConnectionEndpoint):
+    def test_should_respond_200(self, test_client, session):
+        self.create_connections()
+        result = session.query(Connection).all()
+        assert len(result) == 2
+        response = test_client.get("/public/connections/")
+        assert response.status_code == 200
+        assert response.json() == {
+            "connections": [
+                {
+                    "connection_id": TEST_CONN_ID,
+                    "conn_type": TEST_CONN_TYPE,
+                    "description": None,
+                    "extra": None,
+                    "host": None,
+                    "login": None,
+                    "schema": None,
+                    "port": None,
+                },
+                {
+                    "connection_id": TEST_CONN_ID_2,
+                    "conn_type": TEST_CONN_TYPE_2,
+                    "description": None,
+                    "extra": None,
+                    "host": None,
+                    "login": None,
+                    "schema": None,
+                    "port": None,
+                },
+            ],
+            "total_entries": 2,
+        }
+
+    def test_should_respond_200_with_order_by(self, test_client, session):

Review Comment:
   Done.
   
   Also it is important I think for the `order_by` params because at the 
moment, the possible values for sorting are not in the swagger specification. 
(because dynamic). This means that if someone update that and remove some, the 
API spec will not show it, and if tests are not exhaustive on that the CI will 
be green, while this is actually breaking.



-- 
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]

Reply via email to