spr0els commented on code in PR #3224:
URL: https://github.com/apache/iceberg-python/pull/3224#discussion_r3148190676
##########
tests/catalog/test_rest.py:
##########
@@ -1449,6 +1450,38 @@ def test_create_view_409(
assert "View already exists" in str(e.value)
+def test_load_view_200(rest_mock: Mocker, example_view_metadata_rest_json:
dict[str, Any]) -> None:
+ rest_mock.get(
+ f"{TEST_URI}v1/namespaces/fokko/views/view",
+ json=example_view_metadata_rest_json,
+ status_code=200,
+ request_headers=TEST_HEADERS,
+ )
+ catalog = RestCatalog("rest", uri=TEST_URI, token=TEST_TOKEN)
+ actual = catalog.load_view(("fokko", "view"))
+ expected = View(identifier=("fokko", "view"),
metadata=ViewMetadata(**example_view_metadata_rest_json["metadata"]))
+ assert actual == expected
+
+
+def test_load_view_404(rest_mock: Mocker) -> None:
+ rest_mock.get(
+ f"{TEST_URI}v1/namespaces/fokko/views/non_existent_view",
+ json={
+ "error": {
+ "message": "View does not exist: examples.non_existent_view in
warehouse 8bcb0838-50fc-472d-9ddb-8feb89ef5f1e",
+ "type": "NoSuchNamespaceErrorException",
Review Comment:
Good catch. I agree, this should be a `NoSuchViewException`.
There are a two tests for tables in the same file that also return the wrong
error type. These should return `NoSuchTableException`.
https://github.com/apache/iceberg-python/blob/b67b7241690e05413f3cfea69287f897b0b2410e/tests/catalog/test_rest.py#L1157-L1160
https://github.com/apache/iceberg/blob/8d0508308cd068778897c06d3a802740ed4305a6/open-api/rest-catalog-open-api.yaml#L1009-L1018
https://github.com/apache/iceberg-python/blob/b67b7241690e05413f3cfea69287f897b0b2410e/tests/catalog/test_rest.py#L1218-L1221
https://github.com/apache/iceberg/blob/8d0508308cd068778897c06d3a802740ed4305a6/open-api/rest-catalog-open-api.yaml#L1170-L1179
Should I fix all of these in one go or create a issue for the table tests?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]