Skip to content

Commit

Permalink
Refactor notebook creation API endpoint and model to use 'name' and '…
Browse files Browse the repository at this point in the history
…path' instead of 'notebookName' in test_notebook_service.py and fix test_create_and_get_notebook test case
  • Loading branch information
xuwenyihust committed Jul 4, 2024
1 parent b3fe006 commit f7ab8f2
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions server/tests/services/test_notebook_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ def test_get_all_notebooks(self):

def test_create_and_get_notebook(self):
with self.app.app_context():
create_response = Notebook.create_notebook_with_init_cells(notebook_name='Notebook.ipynb', notebook_path='')
# print(create_response)

print(Notebook.get_notebook_by_path(notebook_path='work/Notebook.ipynb')[0])
# notebooks = json.loads(Notebook.get_notebook_by_path(notebook_path='work/Notebook.ipynb'))
# self.assertEqual(len(notebooks), 1)
# self.assertEqual(notebooks['name'], 'Notebook.ipynb')
# self.assertEqual(notebooks['path'], 'work/Notebook.ipynb')
Notebook.create_notebook_with_init_cells(notebook_name='Notebook.ipynb', notebook_path='')

notebooks = json.loads(Notebook.get_notebook_by_path(notebook_path='work/Notebook.ipynb')[0])
status_code = Notebook.get_notebook_by_path(notebook_path='work/Notebook.ipynb')[1]

self.assertEqual(status_code, 200)
self.assertEqual(len(notebooks), 1)
self.assertEqual(notebooks['name'], 'Notebook.ipynb')
self.assertEqual(notebooks['path'], 'work/Notebook.ipynb')

0 comments on commit f7ab8f2

Please sign in to comment.