Skip to content

Commit 98ec0c6

Browse files
committed
add unit test
1 parent d13d4ba commit 98ec0c6

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

tests/io/test_fsspec.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,36 @@ def test_fsspec_s3_session_properties() -> None:
265265
config_kwargs={},
266266
)
267267

268+
def test_fsspec_s3_session_properties_anon_config() -> None:
269+
session_properties: Properties = {
270+
"s3.anonymous": "true",
271+
"s3.endpoint": "http://localhost:9000",
272+
"s3.access-key-id": "admin",
273+
"s3.secret-access-key": "password",
274+
"s3.region": "us-east-1",
275+
"s3.session-token": "s3.session-token",
276+
**UNIFIED_AWS_SESSION_PROPERTIES,
277+
}
278+
279+
with mock.patch("s3fs.S3FileSystem") as mock_s3fs:
280+
s3_fileio = FsspecFileIO(properties=session_properties)
281+
filename = str(uuid.uuid4())
282+
283+
s3_fileio.new_input(location=f"s3://warehouse/{filename}")
284+
285+
mock_s3fs.assert_called_with(
286+
client_kwargs={
287+
"endpoint_url": "http://localhost:9000",
288+
"aws_access_key_id": "admin",
289+
"aws_secret_access_key": "password",
290+
"region_name": "us-east-1",
291+
"aws_session_token": "s3.session-token",
292+
},
293+
config_kwargs={
294+
"anon": True,
295+
},
296+
)
297+
268298

269299
def test_fsspec_unified_session_properties() -> None:
270300
session_properties: Properties = {

0 commit comments

Comments
 (0)