Skip to content

Commit

Permalink
Add notebook_1 creation to test_notebook_service.py
Browse files Browse the repository at this point in the history
  • Loading branch information
xuwenyihust committed Jul 2, 2024
1 parent 04ac87c commit 588021a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions server/tests/services/test_notebook_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from database import db
from app.models.notebook import NotebookModel
from app.services.notebook import Notebook
import json

class NotebookServiceTestCase(unittest.TestCase):

Expand All @@ -22,11 +23,15 @@ def test_get_all_notebooks(self):
with self.app.app_context():
notebook_0 = NotebookModel(name='Notebook0', path='/path/to/notebook0')
db.session.add(notebook_0)

notebook_1 = NotebookModel(name='Notebook1', path='/path/to/notebook1')
db.session.add(notebook_1)

db.session.commit()

notebooks = Notebook.get_all_notebooks()
print(notebooks)
print(len(notebooks))
self.assertEqual(len(notebooks), 1)
notebooks = json.loads(Notebook.get_all_notebooks())
self.assertEqual(len(notebooks), 2)
self.assertEqual(notebooks[0].name, 'Notebook0')
self.assertEqual(notebooks[0].path, '/path/to/notebook0')
self.assertEqual(notebooks[0].path, '/path/to/notebook0')
self.assertEqual(notebooks[1].name, 'Notebook1')
self.assertEqual(notebooks[1].path, '/path/to/notebook1')

0 comments on commit 588021a

Please sign in to comment.