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
  • Loading branch information
xuwenyihust committed Jul 2, 2024
1 parent 6cca3f5 commit 97d0fbf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

notebook:
image: wenyixu101/notebook:latest
env:
JUPYTER_ENABLE_LAB: "no"
ports:
- "8888:8888"
options: --health-cmd "curl -f http://localhost:8888 || exit 1" --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down
13 changes: 12 additions & 1 deletion server/tests/services/test_notebook_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,15 @@ def test_get_all_notebooks(self):
self.assertEqual(notebooks[0]['name'], 'Notebook0')
self.assertEqual(notebooks[0]['path'], '/path/to/notebook0')
self.assertEqual(notebooks[1]['name'], 'Notebook1')
self.assertEqual(notebooks[1]['path'], '/path/to/notebook1')
self.assertEqual(notebooks[1]['path'], '/path/to/notebook1')

def test_get_notebook_by_path(self):
with self.app.app_context():
notebook = NotebookModel(name='Notebook', path='/path/to/notebook')
db.session.add(notebook)
db.session.commit()

notebooks = json.loads(Notebook.get_notebook_by_path(notebook_path='/path/to/notebook'))
self.assertEqual(len(notebooks), 1)
self.assertEqual(notebooks['name'], 'Notebook')
self.assertEqual(notebooks['path'], '/path/to/notebook')

0 comments on commit 97d0fbf

Please sign in to comment.