Various tweaks to theme, more code coverage
This commit is contained in:
parent
c3b83b0238
commit
7c3ec19748
17 changed files with 812 additions and 49 deletions
28
tests/test_settings_module.py
Normal file
28
tests/test_settings_module.py
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
from bouquin.db import DBConfig
|
||||
import bouquin.settings as settings
|
||||
|
||||
|
||||
class FakeSettings:
|
||||
def __init__(self):
|
||||
self.store = {}
|
||||
|
||||
def value(self, key, default=None, type=None):
|
||||
return self.store.get(key, default)
|
||||
|
||||
def setValue(self, key, value):
|
||||
self.store[key] = value
|
||||
|
||||
|
||||
def test_save_and_load_db_config_roundtrip(monkeypatch, tmp_path):
|
||||
fake = FakeSettings()
|
||||
monkeypatch.setattr(settings, "get_settings", lambda: fake)
|
||||
|
||||
cfg = DBConfig(path=tmp_path / "db.sqlite", key="k", idle_minutes=7, theme="dark")
|
||||
settings.save_db_config(cfg)
|
||||
|
||||
# Now read back into a new DBConfig
|
||||
cfg2 = settings.load_db_config()
|
||||
assert cfg2.path == cfg.path
|
||||
assert cfg2.key == "k"
|
||||
assert cfg2.idle_minutes == "7"
|
||||
assert cfg2.theme == "dark"
|
||||
Loading…
Add table
Add a link
Reference in a new issue