-
Notifications
You must be signed in to change notification settings - Fork 12
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
Sharing messaging #481
Merged
Merged
Sharing messaging #481
Changes from 11 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
068e424
updated frontend and backend code to handle 403, 404, 500 errors
dc62f01
adding new build index.js file
e8b76fe
updated the messaging
f6fb587
fixed errors in tests
8b6d120
added logic to cover clicking directly on a card. updated tests, upda…
551174b
updated tests, removed commented out tests
2492a18
fixed linting error
9aac548
removed two tests
7df37e6
added tests for start_server, server_not_found
a290282
updated *Name to Name in test_integration.py test
8094f5f
updated the condtional for starting app, removed unused imports
0ab2931
reverted tests in test_api.py, updated logic to allow admins to start…
c928f15
Trigger re-run of tests
207bfc9
Trigger re-run of tests
0603f1f
Merge branch 'main' into sharing-msg-710
4e82596
updated failing tests, all tests passing
5748f13
removed unnecessary import for pytest
3af53f3
Merge branch 'main' into sharing-msg-710
aktech 9d2fdfa
generate index.js
aktech bcbd244
undo unrequired changes
aktech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,5 +1,6 @@ | ||
import io | ||
import json | ||
import logging | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
|
@@ -9,6 +10,8 @@ | |
from jhub_apps.spawner.types import FRAMEWORKS | ||
from jhub_apps.tests.common.constants import MOCK_USER | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
logger = logging.getLogger(__name__) | ||
|
||
def mock_user_options(): | ||
user_options = { | ||
|
@@ -34,7 +37,6 @@ def mock_user_options(): | |
} | ||
return user_options | ||
|
||
|
||
@patch.object(HubClient, "get_user") | ||
def test_api_get_server(get_user, client): | ||
server_data = {"panel-app": {}} | ||
|
@@ -58,7 +60,6 @@ def test_api_get_server_not_found(get_user, client): | |
'detail': "server 'panel-app-not-found' not found", | ||
} | ||
|
||
|
||
@patch.object(HubClient, "create_server") | ||
def test_api_create_server(create_server, client): | ||
from jhub_apps.service.models import UserOptions | ||
|
@@ -80,40 +81,8 @@ def test_api_create_server(create_server, client): | |
user_options=final_user_options, | ||
) | ||
assert response.status_code == 200 | ||
assert response.json() == create_server_response | ||
|
||
|
||
@patch.object(HubClient, "start_server") | ||
def test_api_start_server(create_server, client): | ||
start_server_response = {"user": "jovyan"} | ||
create_server.return_value = start_server_response | ||
server_name = "server-name" | ||
response = client.post( | ||
f"/server/{server_name}", | ||
) | ||
create_server.assert_called_once_with( | ||
username=MOCK_USER.name, | ||
servername=server_name, | ||
) | ||
assert response.status_code == 200 | ||
assert response.json() == start_server_response | ||
|
||
|
||
@patch.object(HubClient, "start_server") | ||
def test_api_start_server_404(start_server, client): | ||
start_server_response = None | ||
start_server.return_value = start_server_response | ||
server_name = "server-name" | ||
response = client.post( | ||
f"/server/{server_name}", | ||
) | ||
start_server.assert_called_once_with( | ||
username=MOCK_USER.name, | ||
servername=server_name, | ||
) | ||
assert response.status_code == 404 | ||
assert response.json() == {"detail": "server 'server-name' not found"} | ||
|
||
assert response.json() == create_server_response | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'd need to undo removal of these tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reverted. |
||
|
||
@pytest.mark.parametrize("name,remove", [ | ||
('delete', True,), | ||
|
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This permissions part needs to be handled on JupyterHub side (as JupyterHub knows what permissions a user have and jhub-apps service doesn't), jhub-apps service is not responsible for this and besides the checks done here is not sufficient to determine if the user has permissions to start the server or not. We actually just need to call
hub_client.start_server
and based on the response to it, we need to return appropriate response.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.