bugraoz93 commented on code in PR #55744:
URL: https://github.com/apache/airflow/pull/55744#discussion_r2356121806


##########
airflow-ctl/tests/test_create_event_client.py:
##########
@@ -0,0 +1,36 @@
+import json

Review Comment:
   I don't think we need this test, we already have unit tests here
   
https://github.com/apache/airflow/blob/1576db7baaee2890727ae3e0fda33eafce4e5e31/airflow-ctl/tests/airflow_ctl/api/test_operations.py#L334
   
   I think this hasn't been caught because of it needs integration tests



##########
airflow-ctl/src/airflowctl/api/operations.py:
##########
@@ -238,13 +239,23 @@ def list_by_alias(self) -> AssetAliasCollectionResponse | 
ServerResponseError:
         """List all assets by alias from the API server."""
         return super().execute_list(path="/assets/aliases", 
data_model=AssetAliasCollectionResponse)
 
+    def create(self, asset_body: CreateAssetBody) -> AssetResponse | 
ServerResponseError:
+        """Create an asset."""
+        try:
+            self.response = self.client.post(
+                "/assets", json=_date_safe_dict_from_pydantic(asset_body)
+            )
+            return AssetResponse.model_validate_json(self.response.content)
+        except ServerResponseError as e:
+            raise e
+
     def create_event(
         self, asset_event_body: CreateAssetEventsBody
     ) -> AssetEventResponse | ServerResponseError:
         """Create an asset event."""
         try:
             self.response = self.client.post(
-                "assets/events", 
json=_date_safe_dict_from_pydantic(asset_event_body)
+                "/assets/events", 
json=_date_safe_dict_from_pydantic(asset_event_body)

Review Comment:
   Maybe we only left this part in this PR and keep the create part here 
https://github.com/apache/airflow/blob/1576db7baaee2890727ae3e0fda33eafce4e5e31/airflow-ctl/tests/airflow_ctl/api/test_operations.py#L334
   
   We can merge them separately and make it easier to review.  We only need 
this line for the scope of the ticket so that this can quickly merged as fix



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