From ad1dd588522265821288eaca15a3d5b27a96ff57 Mon Sep 17 00:00:00 2001 From: Pedro Crespo-Valero <32402063+pcrespov@users.noreply.github.com> Date: Mon, 4 Nov 2024 19:24:53 +0100 Subject: [PATCH] updates app_environemnt --- .../folders/_trash_handlers.py | 3 +++ .../projects/_trash_handlers.py | 4 ++++ .../web/server/tests/unit/with_dbs/03/test_trash.py | 11 +++++++++++ 3 files changed, 18 insertions(+) diff --git a/services/web/server/src/simcore_service_webserver/folders/_trash_handlers.py b/services/web/server/src/simcore_service_webserver/folders/_trash_handlers.py index 7e0c5f9e8d0e..1f6b84bc3257 100644 --- a/services/web/server/src/simcore_service_webserver/folders/_trash_handlers.py +++ b/services/web/server/src/simcore_service_webserver/folders/_trash_handlers.py @@ -8,6 +8,7 @@ ) from .._meta import API_VTAG as VTAG +from ..application_settings_utils import requires_dev_feature_enabled from ..login.decorators import get_user_id, login_required from ..products.api import get_product_name from ..security.decorators import permission_required @@ -22,6 +23,7 @@ @routes.post(f"/{VTAG}/folders/{{folder_id}}:trash", name="trash_folder") +@requires_dev_feature_enabled @login_required @permission_required("folder.delete") @handle_plugin_requests_exceptions @@ -45,6 +47,7 @@ async def trash_folder(request: web.Request): @routes.post(f"/{VTAG}/folders/{{folder_id}}:untrash", name="untrash_folder") +@requires_dev_feature_enabled @login_required @permission_required("folder.delete") @handle_plugin_requests_exceptions diff --git a/services/web/server/src/simcore_service_webserver/projects/_trash_handlers.py b/services/web/server/src/simcore_service_webserver/projects/_trash_handlers.py index 9adee0345551..91194ea1cd16 100644 --- a/services/web/server/src/simcore_service_webserver/projects/_trash_handlers.py +++ b/services/web/server/src/simcore_service_webserver/projects/_trash_handlers.py @@ -8,6 +8,7 @@ ) from .._meta import API_VTAG as VTAG +from ..application_settings_utils import requires_dev_feature_enabled from ..exceptions_handlers import ( ExceptionToHttpErrorMap, HttpErrorInfo, @@ -57,6 +58,7 @@ @routes.delete(f"/{VTAG}/trash", name="empty_trash") +@requires_dev_feature_enabled @login_required @permission_required("project.delete") @_handle_exceptions @@ -72,6 +74,7 @@ async def empty_trash(request: web.Request): @routes.post(f"/{VTAG}/projects/{{project_id}}:trash", name="trash_project") +@requires_dev_feature_enabled @login_required @permission_required("project.delete") @_handle_exceptions @@ -95,6 +98,7 @@ async def trash_project(request: web.Request): @routes.post(f"/{VTAG}/projects/{{project_id}}:untrash", name="untrash_project") +@requires_dev_feature_enabled @login_required @permission_required("project.delete") @_handle_exceptions diff --git a/services/web/server/tests/unit/with_dbs/03/test_trash.py b/services/web/server/tests/unit/with_dbs/03/test_trash.py index e10dc0065f14..5a760d5f9fdc 100644 --- a/services/web/server/tests/unit/with_dbs/03/test_trash.py +++ b/services/web/server/tests/unit/with_dbs/03/test_trash.py @@ -18,12 +18,23 @@ from models_library.rest_pagination import Page from pytest_mock import MockerFixture from pytest_simcore.helpers.assert_checks import assert_status +from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict +from pytest_simcore.helpers.typing_env import EnvVarsDict from pytest_simcore.helpers.webserver_login import UserInfoDict from servicelib.aiohttp import status from simcore_service_webserver.db.models import UserRole from simcore_service_webserver.projects.models import ProjectDict +@pytest.fixture +def app_environment( + app_environment: EnvVarsDict, monkeypatch: pytest.MonkeyPatch +) -> EnvVarsDict: + return app_environment | setenvs_from_dict( + monkeypatch, {"WEBSERVER_DEV_FEATURES_ENABLED": "1"} + ) + + @pytest.fixture def user_role() -> UserRole: return UserRole.USER