From 8cc843bb8f9b8948f0d7b3a4c4e1ef7213e2671f Mon Sep 17 00:00:00 2001 From: Jacob Lowe Date: Thu, 7 Nov 2024 14:34:26 -0600 Subject: [PATCH 1/4] file fix starting point --- client/src/components/PublicData/PublicData.module.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/PublicData/PublicData.module.css b/client/src/components/PublicData/PublicData.module.css index b16610803..bae153485 100644 --- a/client/src/components/PublicData/PublicData.module.css +++ b/client/src/components/PublicData/PublicData.module.css @@ -1,7 +1,7 @@ .content { /* As a flex child */ flex-grow: 1; - + /* WP-419 */ /* WARNING: Mimicked on: History, Allocation, DataFiles, DataFilesProjectsList, DataFilesProjectFileListing, PublicData */ padding-top: 1.75rem; /* ~28px (22.5px * design * 1.2 design-to-app ratio) */ /* There is no sidebar, so there is no need for space to the left */ From d303b171431d8e3c2f58bbaa6b7d943488231e8d Mon Sep 17 00:00:00 2001 From: Jacob Lowe Date: Mon, 11 Nov 2024 11:23:23 -0600 Subject: [PATCH 2/4] ssh_op_err1 exception addition and test --- server/portal/apps/site_search/api/views.py | 12 ++++++-- .../apps/site_search/views_unit_test.py | 30 +++++++++++++++---- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/server/portal/apps/site_search/api/views.py b/server/portal/apps/site_search/api/views.py index 5eff6f31a..fa7fab86c 100644 --- a/server/portal/apps/site_search/api/views.py +++ b/server/portal/apps/site_search/api/views.py @@ -102,10 +102,18 @@ def get(self, request, *args, **kwargs): return JsonResponse(response) def _handle_tapis_ssh_exception(self, e): - if 'SSH_POOL_MISSING_CREDENTIALS' in str(e) or 'SSH_FX_PERMISSION_DENIED' in str(e): + if ( + "SSH_POOL_MISSING_CREDENTIALS" in str(e) + or "SSH_FX_PERMISSION_DENIED" in str(e) + or "FILES_CLIENT_SSH_OP_ERR1" in str(e) + ): # in case of these error types, user is not authenticated # or does not have access do not fail the entire search # request, log the issue. - logger.exception("Error retrieving search results due to TAPIS SSH related error: {}".format(str(e))) + logger.exception( + "Error retrieving search results due to TAPIS SSH related error: {}".format( + str(e) + ) + ) else: raise diff --git a/server/portal/apps/site_search/views_unit_test.py b/server/portal/apps/site_search/views_unit_test.py index aa775a49f..71834fbac 100644 --- a/server/portal/apps/site_search/views_unit_test.py +++ b/server/portal/apps/site_search/views_unit_test.py @@ -1,18 +1,36 @@ +from unittest.mock import patch + +from tapipy.errors import BaseTapyException + +from portal.apps.site_search.api.views import SiteSearchApiView + + def test_search_unauthenticated(client, regular_user): - response = client.get('/search/') + response = client.get("/search/") assert response.status_code == 200 - assert response.context['setup_complete'] is False + assert response.context["setup_complete"] is False def test_search_authenticated_without_setup_complete(client, authenticated_user): - response = client.get('/search/') + response = client.get("/search/") assert response.status_code == 200 - assert response.context['setup_complete'] is False + assert response.context["setup_complete"] is False def test_search_authenticated_with_setup_complete(client, authenticated_user): authenticated_user.profile.setup_complete = True authenticated_user.profile.save() - response = client.get('/search/') + response = client.get("/search/") assert response.status_code == 200 - assert response.context['setup_complete'] + assert response.context["setup_complete"] + + +@patch("portal.apps.site_search.api.views.logger") +def test_handle_tapis_ssh_exception_files_client_ssh_op_err1(mock_logger): + view = SiteSearchApiView() + message = "FILES_CLIENT_SSH_OP_ERR1" + exception = BaseTapyException(message) + view._handle_tapis_ssh_exception(exception) + mock_logger.exception.assert_called_once_with( + f"Error retrieving search results due to TAPIS SSH related error: message: {message}" + ) From cad0c5c8984e5cf4193d3fb5de45616b9382a7b2 Mon Sep 17 00:00:00 2001 From: Jacob Lowe Date: Mon, 11 Nov 2024 11:32:13 -0600 Subject: [PATCH 3/4] comment fix --- client/src/components/PublicData/PublicData.module.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/src/components/PublicData/PublicData.module.css b/client/src/components/PublicData/PublicData.module.css index bae153485..ff9e1f561 100644 --- a/client/src/components/PublicData/PublicData.module.css +++ b/client/src/components/PublicData/PublicData.module.css @@ -1,10 +1,10 @@ .content { /* As a flex child */ flex-grow: 1; - /* WP-419 */ + /* WARNING: Mimicked on: History, Allocation, DataFiles, DataFilesProjectsList, DataFilesProjectFileListing, PublicData */ padding-top: 1.75rem; /* ~28px (22.5px * design * 1.2 design-to-app ratio) */ /* There is no sidebar, so there is no need for space to the left */ /* FAQ: Public pages, like `PublicData` and `SiteSearch`, have no sidebar */ /* padding-left: 1.5em; /* ~24px (20px * design * 1.2 design-to-app ratio) */ -} +} \ No newline at end of file From 0ef6860704ae1a66c10160b1c86f94fbbbd45334 Mon Sep 17 00:00:00 2001 From: Jacob Lowe Date: Mon, 11 Nov 2024 11:38:00 -0600 Subject: [PATCH 4/4] linting --- client/src/components/PublicData/PublicData.module.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/src/components/PublicData/PublicData.module.css b/client/src/components/PublicData/PublicData.module.css index ff9e1f561..212e959cc 100644 --- a/client/src/components/PublicData/PublicData.module.css +++ b/client/src/components/PublicData/PublicData.module.css @@ -7,4 +7,5 @@ /* There is no sidebar, so there is no need for space to the left */ /* FAQ: Public pages, like `PublicData` and `SiteSearch`, have no sidebar */ /* padding-left: 1.5em; /* ~24px (20px * design * 1.2 design-to-app ratio) */ -} \ No newline at end of file +} +