26 lines
666 B
Python
26 lines
666 B
Python
import pytest
|
|
from models import NoteColours, Settings
|
|
|
|
|
|
def test_log_exception():
|
|
"""Test deliberate exception"""
|
|
|
|
with pytest.raises(Exception):
|
|
1 / 0
|
|
|
|
|
|
def test_create_settings(session):
|
|
SETTING_NAME = "wombat"
|
|
NO_SUCH_SETTING = "abc"
|
|
VALUE = 3
|
|
|
|
setting = Settings(session, SETTING_NAME)
|
|
setting.update(session, dict(f_int=VALUE))
|
|
print(setting)
|
|
_ = Settings.all_as_dict(session)
|
|
test = Settings.get_int_settings(session, SETTING_NAME)
|
|
assert test.name == SETTING_NAME
|
|
assert test.f_int == VALUE
|
|
test_new = Settings.get_int_settings(session, NO_SUCH_SETTING)
|
|
assert test_new.name == NO_SUCH_SETTING
|