|
35 | 35 | OAUTH2_SERVER_URI, |
36 | 36 | SNAPSHOT_LOADING_MODE, |
37 | 37 | Capability, |
| 38 | + Endpoint, |
| 39 | + HttpMethod, |
38 | 40 | RestCatalog, |
39 | 41 | ) |
40 | 42 | from pyiceberg.exceptions import ( |
@@ -1641,6 +1643,19 @@ def test_update_namespace_properties_invalid_namespace(rest_mock: Mocker) -> Non |
1641 | 1643 | assert "Empty namespace identifier" in str(e.value) |
1642 | 1644 |
|
1643 | 1645 |
|
| 1646 | +def test_with_disabled_ssl_ca_bundle(rest_mock: Mocker) -> None: |
| 1647 | + # Given |
| 1648 | + catalog_properties = { |
| 1649 | + "uri": TEST_URI, |
| 1650 | + "token": TEST_TOKEN, |
| 1651 | + "ssl": { |
| 1652 | + "cabundle": False, |
| 1653 | + }, |
| 1654 | + } |
| 1655 | + catalog = RestCatalog("rest", **catalog_properties) # type: ignore |
| 1656 | + assert catalog._session.verify is False |
| 1657 | + |
| 1658 | + |
1644 | 1659 | def test_request_session_with_ssl_ca_bundle(monkeypatch: pytest.MonkeyPatch) -> None: |
1645 | 1660 | # Given |
1646 | 1661 | catalog_properties = { |
@@ -2351,3 +2366,27 @@ def test_table_uuid_check_on_refresh(rest_mock: Mocker, example_table_metadata_v |
2351 | 2366 | assert "Table UUID does not match" in str(exc_info.value) |
2352 | 2367 | assert f"current={original_uuid}" in str(exc_info.value) |
2353 | 2368 | assert f"refreshed={different_uuid}" in str(exc_info.value) |
| 2369 | + |
| 2370 | + |
| 2371 | +def test_endpoint_parsing_from_string_with_valid_http_method() -> None: |
| 2372 | + test_cases = [ |
| 2373 | + ("GET /v1/resource", HttpMethod.GET, "/v1/resource"), |
| 2374 | + ("HEAD /v1/resource", HttpMethod.HEAD, "/v1/resource"), |
| 2375 | + ("POST /v1/resource", HttpMethod.POST, "/v1/resource"), |
| 2376 | + ("DELETE /v1/resource", HttpMethod.DELETE, "/v1/resource"), |
| 2377 | + ("PUT /v1/resource", HttpMethod.PUT, "/v1/resource"), |
| 2378 | + ("CONNECT /v1/resource", HttpMethod.CONNECT, "/v1/resource"), |
| 2379 | + ("OPTIONS /v1/resource", HttpMethod.OPTIONS, "/v1/resource"), |
| 2380 | + ("TRACE /v1/resource", HttpMethod.TRACE, "/v1/resource"), |
| 2381 | + ("PATCH /v1/resource", HttpMethod.PATCH, "/v1/resource"), |
| 2382 | + ] |
| 2383 | + |
| 2384 | + for raw_string, http_method, path in test_cases: |
| 2385 | + endpoint = Endpoint.from_string(raw_string) |
| 2386 | + assert endpoint.http_method == http_method |
| 2387 | + assert endpoint.path == path |
| 2388 | + |
| 2389 | + |
| 2390 | +def test_endpoint_parsing_from_string_with_invalid_http_method() -> None: |
| 2391 | + with pytest.raises(ValueError, match="not a valid HttpMethod"): |
| 2392 | + Endpoint.from_string("INVALID /v1/resource") |
0 commit comments