Skip to content

Commit 543e967

Browse files
author
Quentin FLEURENT NAMBOT
committed
feat: add unit test
1 parent 977c345 commit 543e967

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/catalog/test_rest.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1899,6 +1899,28 @@ def test_rest_catalog_with_google_credentials_path(
18991899
assert actual_headers["Authorization"] == expected_auth_header
19001900

19011901

1902+
@pytest.mark.filterwarnings(
1903+
"ignore:Deprecated in 0.8.0, will be removed in 1.0.0. Iceberg REST client is missing the OAuth2 server URI:DeprecationWarning"
1904+
)
1905+
def test_auth_header(rest_mock: Mocker) -> None:
1906+
mock_request = rest_mock.post(
1907+
f"{TEST_URI}v1/oauth/tokens",
1908+
json={
1909+
"access_token": TEST_TOKEN,
1910+
"token_type": "Bearer",
1911+
"expires_in": 86400,
1912+
"issued_token_type": "urn:ietf:params:oauth:token-type:access_token",
1913+
"scope": "openid offline",
1914+
"refresh_token": "refresh_token",
1915+
},
1916+
status_code=200,
1917+
request_headers={**OAUTH_TEST_HEADERS, "Custom": "Value"},
1918+
)
1919+
1920+
RestCatalog("rest", uri=TEST_URI, credential=TEST_CREDENTIALS, audience="", resource="", **{"header.Custom": "Value"})
1921+
assert mock_request.last_request.text == "grant_type=client_credentials&client_id=client&client_secret=secret&scope=catalog"
1922+
1923+
19021924
class TestRestCatalogClose:
19031925
"""Tests RestCatalog close functionality"""
19041926

0 commit comments

Comments
 (0)