Skip to content

Commit c12e8bd

Browse files
committed
additional testing
1 parent 52ac2ab commit c12e8bd

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import httpx
2+
import pytest
3+
from fastapi import FastAPI, status
4+
from models_library.projects_nodes_io import LocationID
5+
from models_library.users import UserID
6+
from pytest_simcore.helpers.fastapi import url_from_operation_id
7+
from pytest_simcore.helpers.httpx_assert_checks import assert_status
8+
from simcore_service_storage.datcore_dsm import DatCoreDataManager
9+
10+
pytest_simcore_core_services_selection = ["postgres"]
11+
pytest_simcore_ops_services_selection = ["adminer"]
12+
13+
14+
@pytest.mark.parametrize("entrypoint", ["list_paths"])
15+
@pytest.mark.parametrize(
16+
"location_id",
17+
[DatCoreDataManager.get_location_id()],
18+
ids=[DatCoreDataManager.get_location_name()],
19+
indirect=True,
20+
)
21+
async def test_entrypoint_without_api_tokens_return_401(
22+
initialized_app: FastAPI,
23+
client: httpx.AsyncClient,
24+
location_id: LocationID,
25+
entrypoint: str,
26+
user_id: UserID,
27+
):
28+
url = url_from_operation_id(
29+
client, initialized_app, entrypoint, location_id=f"{location_id}"
30+
).with_query(
31+
user_id=user_id,
32+
)
33+
response = await client.get(f"{url}")
34+
assert_status(
35+
response,
36+
status.HTTP_401_UNAUTHORIZED,
37+
None,
38+
)

services/storage/tests/unit/test_handlers_paths.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import httpx
1717
import pytest
1818
import sqlalchemy as sa
19+
from faker import Faker
1920
from fastapi import FastAPI, status
2021
from fastapi_pagination.cursor import CursorPage
2122
from models_library.api_schemas_storage.storage_schemas import (
@@ -680,3 +681,22 @@ async def test_path_compute_size(
680681
)
681682

682683
assert workspace_total_size == accumulated_subfolder_size
684+
685+
686+
async def test_path_compute_size_inexistent_path(
687+
initialized_app: FastAPI,
688+
client: httpx.AsyncClient,
689+
location_id: LocationID,
690+
user_id: UserID,
691+
faker: Faker,
692+
fake_datcore_tokens: tuple[str, str],
693+
):
694+
695+
await _assert_compute_path_total_size(
696+
initialized_app,
697+
client,
698+
location_id,
699+
user_id,
700+
path=Path(faker.file_path(absolute=False)),
701+
expected_total_size=0,
702+
)

0 commit comments

Comments
 (0)