|
19 | 19 | from fastapi import FastAPI, status
|
20 | 20 | from fastapi_pagination.cursor import CursorPage
|
21 | 21 | from models_library.api_schemas_storage.storage_schemas import PathMetaDataGet
|
| 22 | +from models_library.api_schemas_webserver.storage import MAX_NUMBER_OF_PATHS_PER_PAGE |
22 | 23 | from models_library.projects_nodes_io import LocationID, NodeID, SimcoreS3FileID
|
23 | 24 | from models_library.users import UserID
|
24 | 25 | from pydantic import ByteSize, TypeAdapter
|
@@ -203,6 +204,48 @@ async def test_list_paths_pagination(
|
203 | 204 | )
|
204 | 205 |
|
205 | 206 |
|
| 207 | +@pytest.mark.parametrize( |
| 208 | + "project_params", |
| 209 | + [ |
| 210 | + ProjectWithFilesParams( |
| 211 | + num_nodes=1, |
| 212 | + allowed_file_sizes=(TypeAdapter(ByteSize).validate_python("0b"),), |
| 213 | + workspace_files_count=MAX_NUMBER_OF_PATHS_PER_PAGE, |
| 214 | + ) |
| 215 | + ], |
| 216 | + ids=str, |
| 217 | +) |
| 218 | +async def test_list_paths_pagination_large_page( |
| 219 | + initialized_app: FastAPI, |
| 220 | + client: httpx.AsyncClient, |
| 221 | + location_id: LocationID, |
| 222 | + user_id: UserID, |
| 223 | + with_random_project_with_files: tuple[ |
| 224 | + dict[str, Any], |
| 225 | + dict[NodeID, dict[SimcoreS3FileID, FileIDDict]], |
| 226 | + ], |
| 227 | +): |
| 228 | + project, list_of_files = with_random_project_with_files |
| 229 | + selected_node_id = NodeID(random.choice(list(project["workbench"]))) # noqa: S311 |
| 230 | + selected_node_s3_keys = [ |
| 231 | + Path(s3_object_id) for s3_object_id in list_of_files[selected_node_id] |
| 232 | + ] |
| 233 | + workspace_file_filter = Path(project["uuid"]) / f"{selected_node_id}" / "workspace" |
| 234 | + expected_paths = _filter_and_group_paths_one_level_deeper( |
| 235 | + selected_node_s3_keys, workspace_file_filter |
| 236 | + ) |
| 237 | + await _assert_list_paths( |
| 238 | + initialized_app, |
| 239 | + client, |
| 240 | + location_id, |
| 241 | + user_id, |
| 242 | + file_filter=workspace_file_filter, |
| 243 | + expected_paths=expected_paths, |
| 244 | + check_total=False, |
| 245 | + limit=MAX_NUMBER_OF_PATHS_PER_PAGE, |
| 246 | + ) |
| 247 | + |
| 248 | + |
206 | 249 | @pytest.mark.parametrize(
|
207 | 250 | "project_params, num_projects",
|
208 | 251 | [
|
|
0 commit comments