Skip to content

Commit ecbd1d6

Browse files
committed
refactor
1 parent fc1971e commit ecbd1d6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

services/dask-sidecar/tests/unit/test_utils_files.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
pull_file_from_remote,
2525
push_file_to_remote,
2626
)
27+
from types_aiobotocore_s3 import S3Client
2728

2829

2930
@pytest.fixture()
@@ -53,11 +54,11 @@ def ftp_remote_file_url(ftpserver: ProcessFTPServer, faker: Faker) -> AnyUrl:
5354
@pytest.fixture
5455
async def s3_presigned_link_remote_file_url(
5556
s3_settings: S3Settings,
56-
aiobotocore_s3_client,
57+
s3_client: S3Client,
5758
faker: Faker,
5859
) -> AnyUrl:
5960
return TypeAdapter(AnyUrl).validate_python(
60-
await aiobotocore_s3_client.generate_presigned_url(
61+
await s3_client.generate_presigned_url(
6162
"put_object",
6263
Params={"Bucket": s3_settings.S3_BUCKET_NAME, "Key": faker.file_name()},
6364
ExpiresIn=30,
@@ -239,8 +240,7 @@ async def test_pull_file_from_remote(
239240
async def test_pull_file_from_remote_s3_presigned_link(
240241
s3_settings: S3Settings,
241242
s3_remote_file_url: AnyUrl,
242-
aiobotocore_s3_client,
243-
bucket: str,
243+
s3_client: S3Client,
244244
tmp_path: Path,
245245
faker: Faker,
246246
mocked_log_publishing_cb: mock.AsyncMock,
@@ -261,15 +261,17 @@ async def test_pull_file_from_remote_s3_presigned_link(
261261
# create a corresponding presigned get link
262262
assert s3_remote_file_url.path
263263
remote_file_url = TypeAdapter(AnyUrl).validate_python(
264-
await aiobotocore_s3_client.generate_presigned_url(
264+
await s3_client.generate_presigned_url(
265265
"get_object",
266266
Params={
267267
"Bucket": s3_settings.S3_BUCKET_NAME,
268268
"Key": s3_remote_file_url.path.removeprefix("/"),
269269
},
270270
ExpiresIn=30,
271-
),
271+
)
272272
)
273+
assert remote_file_url.scheme.startswith("http")
274+
print(f"remote_file_url: {remote_file_url}")
273275
# now let's get the file through the util
274276
dst_path = tmp_path / faker.file_name()
275277
await pull_file_from_remote(

0 commit comments

Comments
 (0)