convert to markdown
This commit is contained in:
parent
31604a0cd2
commit
6a9d2c4bcc
54 changed files with 1616 additions and 4012 deletions
36
tests/test_settings.py
Normal file
36
tests/test_settings.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
from pathlib import Path
|
||||
from bouquin.settings import (
|
||||
default_db_path,
|
||||
get_settings,
|
||||
load_db_config,
|
||||
save_db_config,
|
||||
)
|
||||
from bouquin.db import DBConfig
|
||||
|
||||
|
||||
def test_default_db_path_returns_writable_path(app, tmp_path):
|
||||
p = default_db_path()
|
||||
assert isinstance(p, Path)
|
||||
p.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
|
||||
def test_load_and_save_db_config_roundtrip(app, tmp_path):
|
||||
s = get_settings()
|
||||
for k in ["db/path", "db/key", "ui/idle_minutes", "ui/theme", "ui/move_todos"]:
|
||||
s.remove(k)
|
||||
|
||||
cfg = DBConfig(
|
||||
path=tmp_path / "notes.db",
|
||||
key="abc123",
|
||||
idle_minutes=7,
|
||||
theme="dark",
|
||||
move_todos=True,
|
||||
)
|
||||
save_db_config(cfg)
|
||||
|
||||
loaded = load_db_config()
|
||||
assert loaded.path == cfg.path
|
||||
assert loaded.key == cfg.key
|
||||
assert loaded.idle_minutes == cfg.idle_minutes
|
||||
assert loaded.theme == cfg.theme
|
||||
assert loaded.move_todos == cfg.move_todos
|
||||
Loading…
Add table
Add a link
Reference in a new issue