-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test case for getting a Spark app by ID in test_spark_app_service.py
- Loading branch information
1 parent
fc57670
commit 339bb01
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,29 @@ def tearDown(self): | |
db.session.remove() | ||
db.drop_all() | ||
|
||
def test_get_spark_by_id(self): | ||
with self.app.app_context(): | ||
# Create User | ||
user_0 = UserModel(name='testuser0', eemail='[email protected]') | ||
password = 'test_password' | ||
user_0.set_password(password) | ||
db.session.add(user_0) | ||
db.session.commit() | ||
g.user = user_0 | ||
|
||
# Create notebook | ||
notebook_0 = NotebookModel(name='Test Notebook', path='/path/to/notebook', user_id=user_0.id) | ||
db.session.add(notebook_0) | ||
db.session.commit() | ||
|
||
# Create spark app | ||
spark_app_0 = SparkAppModel(spark_app_id='1234', notebook_id=notebook_0.id, user_id=user_0.id) | ||
db.session.add(spark_app_0) | ||
|
||
# Get spark app by id | ||
spark_app_1 = SparkApp.get_spark_app_by_id(spark_app_id='1234') | ||
self.assertEqual(spark_app_1.spark_app_id, '1234') | ||
|
||
def test_create_spark_app(self): | ||
with self.app.app_context(): | ||
user_0 = UserModel(name='testuser0', email='[email protected]') | ||
|
@@ -46,3 +69,4 @@ def test_create_spark_app(self): | |
spark_app = SparkAppModel.query.filter_by(spark_app_id='1234').first() | ||
self.assertIsNotNone(spark_app) | ||
|
||
|