Skip to content

Commit e89fd54

Browse files
committed
initial test
1 parent e3cbabb commit e89fd54

File tree

1 file changed

+46
-6
lines changed

1 file changed

+46
-6
lines changed

services/storage/tests/unit/test_handlers_paths.py

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,9 @@ async def test_list_paths_with_display_name_containing_slashes(
446446
)
447447
assert page_of_paths.items[0].display_path == Path(
448448
quote(project_name_with_slashes, safe="")
449-
) / quote(
450-
node_name_with_non_ascii, safe=""
451-
), "display path parts should be url encoded"
449+
) / quote(node_name_with_non_ascii, safe=""), (
450+
"display path parts should be url encoded"
451+
)
452452

453453
# ls in the node workspace
454454
selected_node_id = NodeID(random.choice(list(project["workbench"]))) # noqa: S311
@@ -492,6 +492,46 @@ async def test_list_paths_with_display_name_containing_slashes(
492492
*(expected_paths[0][0].parts[2:]),
493493
],
494494
)
495-
assert page_of_paths.items[0].display_path == Path(
496-
expected_display_path
497-
), "display path parts should be url encoded"
495+
assert page_of_paths.items[0].display_path == Path(expected_display_path), (
496+
"display path parts should be url encoded"
497+
)
498+
499+
500+
@pytest.mark.parametrize(
501+
"project_params",
502+
[
503+
ProjectWithFilesParams(
504+
num_nodes=5,
505+
allowed_file_sizes=(TypeAdapter(ByteSize).validate_python("1b"),),
506+
workspace_files_count=10,
507+
)
508+
],
509+
ids=str,
510+
)
511+
async def test_path_compute_size(
512+
initialized_app: FastAPI,
513+
client: httpx.AsyncClient,
514+
location_id: LocationID,
515+
user_id: UserID,
516+
with_random_project_with_files: tuple[
517+
dict[str, Any],
518+
dict[NodeID, dict[SimcoreS3FileID, FileIDDict]],
519+
],
520+
):
521+
project, list_of_files = with_random_project_with_files
522+
url = url_from_operation_id(
523+
client,
524+
initialized_app,
525+
"compute_path_total_size",
526+
location_id=f"{location_id}",
527+
path=project["uuid"],
528+
).with_query(user_id=user_id)
529+
response = await client.post(f"{url}")
530+
531+
received_size, _ = assert_status(
532+
response,
533+
status.HTTP_200_OK,
534+
ByteSize,
535+
)
536+
assert received_size
537+
assert received_size == 169

0 commit comments

Comments
 (0)