pierrejeambrun commented on code in PR #42782: URL: https://github.com/apache/airflow/pull/42782#discussion_r1801224627
########## 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: Check the way we do for listing dags. I think we can add moer parametrized tests to test additional `order_by` keyword for both ascending and descending, as well as testing the `limit` and `offset` query param. -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org