@@ -508,7 +508,7 @@ async def _assert_compute_path_total_size(
508508 * ,
509509 path : Path ,
510510 expected_total_size : int ,
511- ) -> None :
511+ ) -> ByteSize :
512512 url = url_from_operation_id (
513513 client ,
514514 initialized_app ,
@@ -526,6 +526,7 @@ async def _assert_compute_path_total_size(
526526 assert received
527527 assert received .path == path
528528 assert received .size == expected_total_size
529+ return received .size
529530
530531
531532@pytest .mark .parametrize (
@@ -618,11 +619,38 @@ async def test_path_compute_size(
618619 expected_total_size = project_params .allowed_file_sizes [0 ] * len (
619620 selected_node_s3_keys
620621 )
621- await _assert_compute_path_total_size (
622+ workspace_total_size = await _assert_compute_path_total_size (
622623 initialized_app ,
623624 client ,
624625 location_id ,
625626 user_id ,
626627 path = path ,
627628 expected_total_size = expected_total_size ,
628629 )
630+
631+ # get size of folders inside the workspace
632+ folders_inside_workspace = [
633+ p [0 ]
634+ for p in _filter_and_group_paths_one_level_deeper (selected_node_s3_keys , path )
635+ if p [1 ] is False
636+ ]
637+ accumulated_subfolder_size = 0
638+ for workspace_subfolder in folders_inside_workspace :
639+ selected_node_s3_keys = [
640+ Path (s3_object_id )
641+ for s3_object_id in list_of_files [selected_node_id ]
642+ if s3_object_id .startswith (f"{ workspace_subfolder } " )
643+ ]
644+ expected_total_size = project_params .allowed_file_sizes [0 ] * len (
645+ selected_node_s3_keys
646+ )
647+ accumulated_subfolder_size += await _assert_compute_path_total_size (
648+ initialized_app ,
649+ client ,
650+ location_id ,
651+ user_id ,
652+ path = workspace_subfolder ,
653+ expected_total_size = expected_total_size ,
654+ )
655+
656+ assert workspace_total_size == accumulated_subfolder_size
0 commit comments