Various tweaks to theme, more code coverage

This commit is contained in:
Miguel Jacq 2025-11-06 11:47:00 +11:00
parent c3b83b0238
commit 7c3ec19748
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
17 changed files with 812 additions and 49 deletions

View 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"