38 lines
753 B
Python
38 lines
753 B
Python
# Standard library imports
|
|
import unittest
|
|
|
|
# PyQt imports
|
|
|
|
# Third party imports
|
|
import pytest
|
|
|
|
# App imports
|
|
from app.models import db
|
|
import ds
|
|
|
|
|
|
class TestMMMisc(unittest.TestCase):
|
|
def setUp(self):
|
|
db.create_all()
|
|
|
|
def tearDown(self):
|
|
db.drop_all()
|
|
|
|
def test_log_exception(self):
|
|
"""Test deliberate exception"""
|
|
|
|
with pytest.raises(Exception):
|
|
1 / 0
|
|
|
|
def test_create_settings(self):
|
|
SETTING_NAME = "wombat"
|
|
NO_SUCH_SETTING = "abc"
|
|
VALUE = 3
|
|
|
|
test_non_existant = ds.setting_get(SETTING_NAME)
|
|
assert test_non_existant is None
|
|
|
|
ds.setting_set(SETTING_NAME, VALUE)
|
|
test_ok = ds.setting_get(SETTING_NAME)
|
|
assert test_ok == VALUE
|