@@ -157,16 +157,16 @@ async def test_list_paths_pagination(
157157 user_id : UserID ,
158158 with_random_project_with_files : tuple [
159159 dict [str , Any ],
160+ dict [NodeID , dict [str , Any ]],
160161 dict [NodeID , dict [SimcoreS3FileID , FileIDDict ]],
161162 ],
162163):
163- project , list_of_files = with_random_project_with_files
164- num_nodes = len (list (project ["workbench" ]))
164+ project , nodes , list_of_files = with_random_project_with_files
165165
166166 # ls the nodes (DB-based)
167167 file_filter = Path (project ["uuid" ])
168168 expected_paths = sorted (
169- ((file_filter / node_key , False ) for node_key in project [ "workbench" ] ),
169+ ((file_filter / f" { node_id } " , False ) for node_id in nodes ),
170170 key = lambda x : x [0 ],
171171 )
172172 await _assert_list_paths (
@@ -176,12 +176,12 @@ async def test_list_paths_pagination(
176176 user_id ,
177177 file_filter = file_filter ,
178178 expected_paths = expected_paths ,
179- limit = int (num_nodes / 2 + 0.5 ),
179+ limit = int (len ( nodes ) / 2 + 0.5 ),
180180 )
181181
182182 # ls in the workspace (S3-based)
183183 # ls in the workspace
184- selected_node_id = NodeID ( random .choice (list (project [ "workbench" ] ))) # noqa: S311
184+ selected_node_id = random .choice (list (nodes . keys ( ))) # noqa: S311
185185 selected_node_s3_keys = [
186186 Path (s3_object_id ) for s3_object_id in list_of_files [selected_node_id ]
187187 ]
@@ -240,11 +240,12 @@ async def test_list_paths_pagination_large_page(
240240 user_id : UserID ,
241241 with_random_project_with_files : tuple [
242242 dict [str , Any ],
243+ dict [NodeID , dict [str , Any ]],
243244 dict [NodeID , dict [SimcoreS3FileID , FileIDDict ]],
244245 ],
245246):
246- project , list_of_files = with_random_project_with_files
247- selected_node_id = NodeID ( random .choice (list (project [ "workbench" ] ))) # noqa: S311
247+ project , nodes , list_of_files = with_random_project_with_files
248+ selected_node_id = random .choice (list (nodes . keys ( ))) # noqa: S311
248249 selected_node_s3_keys = [
249250 Path (s3_object_id ) for s3_object_id in list_of_files [selected_node_id ]
250251 ]
@@ -292,7 +293,11 @@ async def test_list_paths(
292293 random_project_with_files : Callable [
293294 [ProjectWithFilesParams ],
294295 Awaitable [
295- tuple [dict [str , Any ], dict [NodeID , dict [SimcoreS3FileID , FileIDDict ]]]
296+ tuple [
297+ dict [str , Any ],
298+ dict [NodeID , dict [str , Any ]],
299+ dict [NodeID , dict [SimcoreS3FileID , FileIDDict ]],
300+ ]
296301 ],
297302 ],
298303 project_params : ProjectWithFilesParams ,
@@ -305,7 +310,10 @@ async def test_list_paths(
305310
306311 # ls root returns our projects
307312 expected_paths = sorted (
308- ((Path (f"{ prj_db ['uuid' ]} " ), False ) for prj_db , _ in project_to_files_mapping ),
313+ (
314+ (Path (f"{ prj_db ['uuid' ]} " ), False )
315+ for prj_db , _ , _ in project_to_files_mapping
316+ ),
309317 key = lambda x : x [0 ],
310318 )
311319 await _assert_list_paths (
@@ -318,9 +326,9 @@ async def test_list_paths(
318326 )
319327
320328 # ls with only some part of the path should return only the projects that match
321- selected_project , selected_project_files = random .choice ( # noqa: S311
329+ selected_project , selected_nodes , selected_project_files = random .choice (
322330 project_to_files_mapping
323- )
331+ ) # noqa: S311
324332 partial_file_filter = Path (
325333 selected_project ["uuid" ][: len (selected_project ["uuid" ]) // 2 ]
326334 )
@@ -340,7 +348,7 @@ async def test_list_paths(
340348 # now we ls inside one of the projects returns the nodes
341349 file_filter = Path (selected_project ["uuid" ])
342350 expected_paths = sorted (
343- ((file_filter / node_key , False ) for node_key in selected_project [ "workbench" ] ),
351+ ((file_filter / f" { node_id } " , False ) for node_id in selected_nodes ),
344352 key = lambda x : x [0 ],
345353 )
346354 await _assert_list_paths (
@@ -353,9 +361,7 @@ async def test_list_paths(
353361 )
354362
355363 # now we ls in one of the nodes
356- selected_node_id = NodeID (
357- random .choice (list (selected_project ["workbench" ])) # noqa: S311
358- )
364+ selected_node_id = random .choice (list (selected_nodes )) # noqa: S311
359365 selected_node_s3_keys = [
360366 Path (s3_object_id ) for s3_object_id in selected_project_files [selected_node_id ]
361367 ]
@@ -623,14 +629,15 @@ async def test_path_compute_size(
623629 user_id : UserID ,
624630 with_random_project_with_files : tuple [
625631 dict [str , Any ],
632+ dict [NodeID , dict [str , Any ]],
626633 dict [NodeID , dict [SimcoreS3FileID , FileIDDict ]],
627634 ],
628635 project_params : ProjectWithFilesParams ,
629636):
630637 assert (
631638 len (project_params .allowed_file_sizes ) == 1
632639 ), "test preconditions are not filled! allowed file sizes should have only 1 option for this test"
633- project , list_of_files = with_random_project_with_files
640+ project , nodes , list_of_files = with_random_project_with_files
634641
635642 total_num_files = sum (
636643 len (files_in_node ) for files_in_node in list_of_files .values ()
@@ -649,7 +656,7 @@ async def test_path_compute_size(
649656 )
650657
651658 # get size of one of the nodes
652- selected_node_id = NodeID ( random .choice (list (project [ "workbench" ] ))) # noqa: S311
659+ selected_node_id = random .choice (list (nodes . keys ( ))) # noqa: S311
653660 path = Path (project ["uuid" ]) / f"{ selected_node_id } "
654661 selected_node_s3_keys = [
655662 Path (s3_object_id ) for s3_object_id in list_of_files [selected_node_id ]
0 commit comments