pierrejeambrun commented on code in PR #44121:
URL: https://github.com/apache/airflow/pull/44121#discussion_r1850325972
##########
tests/api_fastapi/core_api/routes/public/test_pools.py:
##########
@@ -54,6 +54,27 @@ def teardown_method(self) -> None:
def create_pools(self):
_create_pools()
+ def _create_pool_in_test(
+ self,
+ test_client,
+ session,
+ body,
+ expected_status_code,
+ expected_response,
+ create_default=True,
+ check_count=True,
+ ):
+ if create_default:
+ self.create_pools()
+ if check_count:
+ n_pools = session.query(Pool).count()
+ response = test_client.post("/public/pools/", json=body)
+ assert response.status_code == expected_status_code
+
+ assert response.json() == expected_response
+ if check_count:
+ assert session.query(Pool).count() == n_pools + 1
+
Review Comment:
Maybe don't factorize this part. It looks like this is an `Arrange` function
(sense of Arrange/Act/Assert), like others similar function in tests, to
prepare some objects for the test. But then it actually is a 'full' test, with
assertions etc...
We only re-use this a 2 places, we can leave that inlined, especially the
code won't be exacly the same and simple for the `409` case
--
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]