Skip to content

Commit

Permalink
Refactor directory service to include default path handling in get_co…
Browse files Browse the repository at this point in the history
…ntent_by_path method
  • Loading branch information
xuwenyihust committed Jul 8, 2024
1 parent ef91c7b commit b81ac4a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions server/app/services/directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def get_content_by_path(path: str = None):
jupyter_api_path = app.config['JUPYTER_API_PATH']
jupyter_default_path = app.config['JUPYTER_DEFAULT_PATH']

if path is None:
path = jupyter_default_path
path = f"{jupyter_api_path}/{path}"
response = requests.get(path)

Expand Down
2 changes: 1 addition & 1 deletion server/tests/services/test_notebook_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_create_and_get_notebook(self):

self.assertTrue(notebook_name_1.startswith('notebook_'))
self.assertTrue(notebook_name_1.endswith('.ipynb'))
self.assertEquals('work/' + notebook_name_1, notebook_path_1)
self.assertEqual('work/' + notebook_name_1, notebook_path_1)

get_response_1 = Notebook.get_notebook_by_path(notebook_path=notebook_path_1)
notebook_1 = get_response_1[0]
Expand Down

0 comments on commit b81ac4a

Please sign in to comment.