-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug/WP-418: site search error when user does not have community file …
…listing access. (#1005) * file fix starting point * ssh_op_err1 exception addition and test * comment fix * linting
- Loading branch information
Showing
3 changed files
with
35 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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}" | ||
) |