Skip to content

Commit feb4cd2

Browse files
committed
improve test
1 parent b2d2373 commit feb4cd2

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

services/storage/tests/unit/test_handlers_paths.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,9 @@ async def test_list_paths_with_display_name_containing_slashes(
449449
)
450450
assert page_of_paths.items[0].display_path == Path(
451451
quote(project_name_with_slashes, safe="")
452-
) / quote(node_name_with_non_ascii, safe=""), (
453-
"display path parts should be url encoded"
454-
)
452+
) / quote(
453+
node_name_with_non_ascii, safe=""
454+
), "display path parts should be url encoded"
455455

456456
# ls in the node workspace
457457
selected_node_id = NodeID(random.choice(list(project["workbench"]))) # noqa: S311
@@ -495,9 +495,9 @@ async def test_list_paths_with_display_name_containing_slashes(
495495
*(expected_paths[0][0].parts[2:]),
496496
],
497497
)
498-
assert page_of_paths.items[0].display_path == Path(expected_display_path), (
499-
"display path parts should be url encoded"
500-
)
498+
assert page_of_paths.items[0].display_path == Path(
499+
expected_display_path
500+
), "display path parts should be url encoded"
501501

502502

503503
@pytest.mark.parametrize(
@@ -520,7 +520,20 @@ async def test_path_compute_size(
520520
dict[str, Any],
521521
dict[NodeID, dict[SimcoreS3FileID, FileIDDict]],
522522
],
523+
project_params: ProjectWithFilesParams,
523524
):
525+
assert (
526+
len(project_params.allowed_file_sizes) == 1
527+
), "test preconditions are not filled! allowed file sizes should have only 1 option for this test"
528+
num_output_files_per_node = 3
529+
total_num_files_per_node = (
530+
num_output_files_per_node + project_params.workspace_files_count
531+
)
532+
expected_project_total_size = (
533+
project_params.allowed_file_sizes[0]
534+
* project_params.num_nodes
535+
* total_num_files_per_node
536+
)
524537
project, list_of_files = with_random_project_with_files
525538
url = url_from_operation_id(
526539
client,
@@ -538,4 +551,4 @@ async def test_path_compute_size(
538551
)
539552
assert received
540553
assert received.path == Path(project["uuid"])
541-
assert received.size == 169
554+
assert received.size == expected_project_total_size

0 commit comments

Comments
 (0)