You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/06/16 16:24:22 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #9329: [WIP] Pool CRUD Endpoints

mik-laj commented on a change in pull request #9329:
URL: https://github.com/apache/airflow/pull/9329#discussion_r440981222



##########
File path: tests/api_connexion/endpoints/test_pool_endpoint.py
##########
@@ -141,3 +141,69 @@ def test_response_404(self):
             },
             response.json,
         )
+
+
+class TestDeletePool(TestBasePoolEndpoints):
+    @provide_session
+    def test_response_204(self, session):
+        pool_name = "test_pool"
+        pool_instance = Pool(pool=pool_name, slots=3)
+        session.add(pool_instance)
+        session.commit()
+        
+        response = self.client.delete(f"api/v1/pools/{pool_name}")
+        assert response.status_code == 204
+        # Check if the pool is deleted from the db
+        response = self.client.get(f"api/v1/pools/{pool_name}")
+        self.assertEqual(response.status_code, 404)
+
+    @provide_session
+    def test_response_404(self, session):
+        response = self.client.delete("api/v1/pools/invalid_pool")
+        self.assertEqual(response.status_code, 404)
+
+class TestPostPool(TestBasePoolEndpoints):
+    @provide_session
+    def test_response_200(self, session):
+        response = self.client.post("api/v1/pools", json={
+            "name": "test_pool_a",
+            "slots": 3
+        })
+        assert response.status_code == 200
+        self.assertEqual(
+            {
+                "name": "test_pool_a",
+                "slots": 3,
+                "occupied_slots": 0,
+                "running_slots": 0,
+                "queued_slots": 0,
+                "open_slots": 3,
+            },
+            response.json,
+        )
+    
+    @provide_session
+    def test_response_409(self, session):

Review comment:
       Could you add this error code to the specification?




----------------------------------------------------------------
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:
users@infra.apache.org