Skip to content

Commit

Permalink
Add support for UserModel and create user in test_spark_app_config_mo…
Browse files Browse the repository at this point in the history
…del.py
  • Loading branch information
xuwenyihust committed Aug 19, 2024
1 parent 93f77db commit 87d6802
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion server/tests/models/test_spark_app_config_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from database import db
from app.models.spark_app_config import SparkAppConfigModel
from app.models.notebook import NotebookModel
from app.models.user import UserModel

class SparkAppConfigModelTestCase(unittest.TestCase):

Expand All @@ -20,8 +21,17 @@ def tearDown(self):

def test_spark_app_config_model(self):
with self.app.app_context():
# Create user
user = UserModel(name='testuser', email='[email protected]')
password = 'test_password'
user.set_password(password)
db.session.add(user)
db.session.commit()

self.assert_Equal(user.id, 1)

# Create notebook
notebook = NotebookModel(path='test_notebook', user_id=1)
notebook = NotebookModel(name = 'test_notebook', path='test_notebook', user_id=1)
db.session.add(notebook)
db.session.commit()

Expand Down

0 comments on commit 87d6802

Please sign in to comment.