|
14 | 14 | import fsspec |
15 | 15 | import pytest |
16 | 16 | import simcore_service_dask_sidecar |
17 | | -from aiobotocore.session import AioBaseClient, get_session |
18 | 17 | from common_library.json_serialization import json_dumps |
19 | 18 | from common_library.serialization import model_dump_with_secrets |
20 | 19 | from dask_task_models_library.container_tasks.protocol import TaskOwner |
|
36 | 35 |
|
37 | 36 | pytest_plugins = [ |
38 | 37 | "pytest_simcore.aws_server", |
| 38 | + "pytest_simcore.aws_s3_service", |
39 | 39 | "pytest_simcore.cli_runner", |
40 | 40 | "pytest_simcore.docker_compose", |
41 | 41 | "pytest_simcore.docker_registry", |
@@ -179,45 +179,6 @@ def s3_settings(mocked_s3_server_envs: None) -> S3Settings: |
179 | 179 | return S3Settings.create_from_envs() |
180 | 180 |
|
181 | 181 |
|
182 | | -@pytest.fixture |
183 | | -def s3_endpoint_url(s3_settings: S3Settings) -> AnyUrl: |
184 | | - assert s3_settings.S3_ENDPOINT |
185 | | - return TypeAdapter(AnyUrl).validate_python( |
186 | | - f"{s3_settings.S3_ENDPOINT}", |
187 | | - ) |
188 | | - |
189 | | - |
190 | | -@pytest.fixture |
191 | | -async def aiobotocore_s3_client( |
192 | | - s3_settings: S3Settings, s3_endpoint_url: AnyUrl |
193 | | -) -> AsyncIterator[AioBaseClient]: |
194 | | - session = get_session() |
195 | | - async with session.create_client( |
196 | | - "s3", |
197 | | - endpoint_url=f"{s3_endpoint_url}", |
198 | | - aws_secret_access_key="xxx", # noqa: S106 |
199 | | - aws_access_key_id="xxx", |
200 | | - ) as client: |
201 | | - yield client |
202 | | - |
203 | | - |
204 | | -@pytest.fixture |
205 | | -async def bucket( |
206 | | - aiobotocore_s3_client: AioBaseClient, s3_settings: S3Settings |
207 | | -) -> AsyncIterator[str]: |
208 | | - response = await aiobotocore_s3_client.create_bucket( |
209 | | - Bucket=s3_settings.S3_BUCKET_NAME |
210 | | - ) |
211 | | - assert "ResponseMetadata" in response |
212 | | - assert "HTTPStatusCode" in response["ResponseMetadata"] |
213 | | - assert response["ResponseMetadata"]["HTTPStatusCode"] == 200 |
214 | | - |
215 | | - response = await aiobotocore_s3_client.list_buckets() |
216 | | - assert response["Buckets"] |
217 | | - assert len(response["Buckets"]) == 1 |
218 | | - return response["Buckets"][0]["Name"] |
219 | | - |
220 | | - |
221 | 182 | @pytest.fixture |
222 | 183 | def s3_remote_file_url(s3_settings: S3Settings, faker: Faker) -> Callable[..., AnyUrl]: |
223 | 184 | def creator(file_path: Path | None = None) -> AnyUrl: |
|
0 commit comments