Remove sessions from test_misc.py
This commit is contained in:
parent
a2baf489c3
commit
5317ecdf18
@ -7,7 +7,8 @@ import unittest
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
# App imports
|
# App imports
|
||||||
from app.models import db, Settings
|
from app.models import db
|
||||||
|
import ds
|
||||||
|
|
||||||
|
|
||||||
class TestMMMisc(unittest.TestCase):
|
class TestMMMisc(unittest.TestCase):
|
||||||
@ -28,13 +29,9 @@ class TestMMMisc(unittest.TestCase):
|
|||||||
NO_SUCH_SETTING = "abc"
|
NO_SUCH_SETTING = "abc"
|
||||||
VALUE = 3
|
VALUE = 3
|
||||||
|
|
||||||
with db.Session() as session:
|
test_non_existant = ds.setting_get(SETTING_NAME)
|
||||||
setting = Settings(session, SETTING_NAME)
|
assert test_non_existant is None
|
||||||
# test repr
|
|
||||||
_ = str(setting)
|
ds.setting_set(SETTING_NAME, VALUE)
|
||||||
setting.f_int = VALUE
|
test_ok = ds.setting_get(SETTING_NAME)
|
||||||
test = Settings.get_setting(session, SETTING_NAME)
|
assert test_ok == VALUE
|
||||||
assert test.name == SETTING_NAME
|
|
||||||
assert test.f_int == VALUE
|
|
||||||
test_new = Settings.get_setting(session, NO_SUCH_SETTING)
|
|
||||||
assert test_new.name == NO_SUCH_SETTING
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user