tsungchih commented on code in PR #10575:
URL: https://github.com/apache/gravitino/pull/10575#discussion_r3031282161


##########
clients/client-python/tests/unittests/test_relational_catalog.py:
##########
@@ -228,6 +231,23 @@ def test_load_table(self):
             table = self.catalog.load_table(self.table_identifier)
             self.assertEqual(table.name(), self.table_dto.name())
 
+    def test_load_table_with_required_privilege_names(self):
+        resp_body = TableResponse(0, self.table_dto)
+        mock_resp = self._get_mock_http_resp(resp_body.to_json())
+
+        with patch(
+            "gravitino.utils.http_client.HTTPClient.get",
+            return_value=mock_resp,
+        ) as mock_get:
+            privileges = {Privilege.Name.SELECT_TABLE, 
Privilege.Name.MODIFY_TABLE}
+            table = self.catalog.load_table(
+                self.table_identifier, required_privilege_names=privileges
+            )
+            self.assertEqual(table.name(), self.table_dto.name())
+            mock_get.assert_called_once()
+            call_args = mock_get.call_args
+            self.assertIn("privileges", call_args.kwargs["params"])
+

Review Comment:
   addressed



##########
clients/client-python/tests/unittests/dto/util/test_dto_converters_to_table_update_request.py:
##########
@@ -0,0 +1,283 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+import unittest
+from typing import cast
+
+from gravitino.api.rel.expressions.literals.literals import Literals
+from gravitino.api.rel.indexes.index import Index
+from gravitino.api.rel.table_change import TableChange
+from gravitino.api.rel.types.types import Types
+from gravitino.dto.rel.expressions.literal_dto import LiteralDTO
+from gravitino.dto.requests.table_update_request import TableUpdateRequest
+from gravitino.dto.util.dto_converters import DTOConverters
+from gravitino.exceptions.base import IllegalArgumentException
+
+
+class TestDTOConvertersToTableUpdateRequest(unittest.TestCase):
+    def test_to_table_update_request_add_column_with_default_value(self):
+        """Tests the conversion of an add column change with a default value 
to a TableUpdateRequest."""
+        add_column = TableChange.add_column(
+            field_name=["new_col"],
+            data_type=Types.IntegerType.get(),
+            comment="test column",
+            nullable=False,
+            auto_increment=True,
+            default_value=Literals.integer_literal(10),
+        )
+        result = cast(
+            TableUpdateRequest.AddTableColumnRequest,
+            DTOConverters.to_table_update_request(add_column),
+        )
+        self.assertIsInstance(result, TableUpdateRequest.AddTableColumnRequest)
+        add_column_request = cast(TableUpdateRequest.AddTableColumnRequest, 
result)
+        self.assertListEqual(add_column_request.field_name, ["new_col"])
+        self.assertEqual(add_column_request.data_type, Types.IntegerType.get())
+        self.assertEqual(add_column_request.comment, "test column")
+        self.assertIsNone(add_column_request.position)
+        self.assertFalse(add_column_request.is_nullable)
+        self.assertTrue(add_column_request.is_auto_increment)
+

Review Comment:
   addressed



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