Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 viewers can now use new style dynamic services #6023

Merged
merged 3 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
""" Handles request to the viewers redirection entrypoints

"""

import functools
import logging
import urllib.parse
Expand All @@ -16,6 +17,7 @@
from servicelib.aiohttp.typing_extension import Handler
from servicelib.error_codes import create_error_code

from ..director_v2.api import update_dynamic_service_networks_in_project
from ..products.api import get_product_name
from ..utils import compose_support_error_msg
from ..utils_aiohttp import create_redirect_to_page_response
Expand Down Expand Up @@ -252,6 +254,7 @@ async def get_redirection_to_viewer(request: web.Request):
file_params.download_link,
product_name=get_product_name(request),
)
await update_dynamic_service_networks_in_project(request.app, project_id)

response = _create_redirect_response_to_view_page(
request.app,
Expand Down Expand Up @@ -280,6 +283,7 @@ async def get_redirection_to_viewer(request: web.Request):
service_info=_create_service_info_from(valid_service),
product_name=get_product_name(request),
)
await update_dynamic_service_networks_in_project(request.app, project_id)

response = _create_redirect_response_to_view_page(
request.app,
Expand Down Expand Up @@ -315,6 +319,7 @@ async def get_redirection_to_viewer(request: web.Request):
).STUDIES_DEFAULT_FILE_THUMBNAIL,
product_name=get_product_name(request),
)
await update_dynamic_service_networks_in_project(request.app, project_id)

response = _create_redirect_response_to_view_page(
request.app,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ async def test_dispatch_study_anonymously(
"simcore_service_webserver.director_v2.api.create_or_update_pipeline",
return_value=None,
)
mock_client_director_v2_project_networks = mocker.patch(
"simcore_service_webserver.studies_dispatcher._redirects_handlers.update_dynamic_service_networks_in_project",
return_value=None,
)

response = await client.get(f"{redirect_url}")

Expand Down Expand Up @@ -435,6 +439,7 @@ async def test_dispatch_study_anonymously(
assert guest_project["prjOwner"] == data["login"]

assert mock_client_director_v2_func.called
assert mock_client_director_v2_project_networks.called


@pytest.mark.parametrize(
Expand All @@ -455,10 +460,14 @@ async def test_dispatch_logged_in_user(
mocks_on_projects_api,
):
assert client.app
mock_client_director_v2_func = mocker.patch(
mock_client_director_v2_pipline_update = mocker.patch(
"simcore_service_webserver.director_v2.api.create_or_update_pipeline",
return_value=None,
)
mock_client_director_v2_project_networks = mocker.patch(
"simcore_service_webserver.studies_dispatcher._redirects_handlers.update_dynamic_service_networks_in_project",
return_value=None,
)

response = await client.get(f"{redirect_url}")

Expand Down Expand Up @@ -487,7 +496,8 @@ async def test_dispatch_logged_in_user(
assert expected_project_id == created_project["uuid"]
assert created_project["prjOwner"] == data["login"]

assert mock_client_director_v2_func.called
assert mock_client_director_v2_pipline_update.called
assert mock_client_director_v2_project_networks.called

# delete before exiting
url = client.app.router["delete_project"].url_for(project_id=expected_project_id)
Expand Down
Loading