|
37 | 37 | SIGV4_MAX_RETRIES, |
38 | 38 | SNAPSHOT_LOADING_MODE, |
39 | 39 | Capability, |
| 40 | + Endpoint, |
| 41 | + HttpMethod, |
40 | 42 | RestCatalog, |
41 | 43 | ) |
42 | 44 | from pyiceberg.exceptions import ( |
@@ -1704,6 +1706,19 @@ def test_update_namespace_properties_invalid_namespace(rest_mock: Mocker) -> Non |
1704 | 1706 | assert "Empty namespace identifier" in str(e.value) |
1705 | 1707 |
|
1706 | 1708 |
|
| 1709 | +def test_with_disabled_ssl_ca_bundle(rest_mock: Mocker) -> None: |
| 1710 | + # Given |
| 1711 | + catalog_properties = { |
| 1712 | + "uri": TEST_URI, |
| 1713 | + "token": TEST_TOKEN, |
| 1714 | + "ssl": { |
| 1715 | + "cabundle": False, |
| 1716 | + }, |
| 1717 | + } |
| 1718 | + catalog = RestCatalog("rest", **catalog_properties) # type: ignore |
| 1719 | + assert catalog._session.verify is False |
| 1720 | + |
| 1721 | + |
1707 | 1722 | def test_request_session_with_ssl_ca_bundle(monkeypatch: pytest.MonkeyPatch) -> None: |
1708 | 1723 | # Given |
1709 | 1724 | catalog_properties = { |
@@ -2414,3 +2429,27 @@ def test_table_uuid_check_on_refresh(rest_mock: Mocker, example_table_metadata_v |
2414 | 2429 | assert "Table UUID does not match" in str(exc_info.value) |
2415 | 2430 | assert f"current={original_uuid}" in str(exc_info.value) |
2416 | 2431 | assert f"refreshed={different_uuid}" in str(exc_info.value) |
| 2432 | + |
| 2433 | + |
| 2434 | +def test_endpoint_parsing_from_string_with_valid_http_method() -> None: |
| 2435 | + test_cases = [ |
| 2436 | + ("GET /v1/resource", HttpMethod.GET, "/v1/resource"), |
| 2437 | + ("HEAD /v1/resource", HttpMethod.HEAD, "/v1/resource"), |
| 2438 | + ("POST /v1/resource", HttpMethod.POST, "/v1/resource"), |
| 2439 | + ("DELETE /v1/resource", HttpMethod.DELETE, "/v1/resource"), |
| 2440 | + ("PUT /v1/resource", HttpMethod.PUT, "/v1/resource"), |
| 2441 | + ("CONNECT /v1/resource", HttpMethod.CONNECT, "/v1/resource"), |
| 2442 | + ("OPTIONS /v1/resource", HttpMethod.OPTIONS, "/v1/resource"), |
| 2443 | + ("TRACE /v1/resource", HttpMethod.TRACE, "/v1/resource"), |
| 2444 | + ("PATCH /v1/resource", HttpMethod.PATCH, "/v1/resource"), |
| 2445 | + ] |
| 2446 | + |
| 2447 | + for raw_string, http_method, path in test_cases: |
| 2448 | + endpoint = Endpoint.from_string(raw_string) |
| 2449 | + assert endpoint.http_method == http_method |
| 2450 | + assert endpoint.path == path |
| 2451 | + |
| 2452 | + |
| 2453 | +def test_endpoint_parsing_from_string_with_invalid_http_method() -> None: |
| 2454 | + with pytest.raises(ValueError, match="not a valid HttpMethod"): |
| 2455 | + Endpoint.from_string("INVALID /v1/resource") |
0 commit comments