Fix history pane, some small cleanups
This commit is contained in:
parent
f023224074
commit
ab1af80d10
12 changed files with 47 additions and 114 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import pytest
|
||||
import json, csv
|
||||
import datetime as dt
|
||||
|
||||
from bouquin.db import DBManager
|
||||
|
||||
def _today():
|
||||
return dt.date.today().isoformat()
|
||||
|
|
@ -57,7 +59,7 @@ def test_dates_with_content_and_search(fresh_db):
|
|||
assert any(d == _tomorrow() for d, _ in hits)
|
||||
|
||||
|
||||
def test_get_all_entries_and_export_by_extension(fresh_db, tmp_path):
|
||||
def test_get_all_entries_and_export(fresh_db, tmp_path):
|
||||
for i in range(3):
|
||||
d = (dt.date.today() - dt.timedelta(days=i)).isoformat()
|
||||
fresh_db.save_new_version(d, _entry(f"note {i}"), f"note {i}")
|
||||
|
|
@ -93,18 +95,12 @@ def test_get_all_entries_and_export_by_extension(fresh_db, tmp_path):
|
|||
fresh_db.export_sqlcipher(str(sqlc_path))
|
||||
assert sqlc_path.exists() and sqlc_path.read_bytes()
|
||||
|
||||
for path in [json_path, csv_path, txt_path, md_path, html_path, sql_path]:
|
||||
path.unlink(missing_ok=True)
|
||||
fresh_db.export_by_extension(str(path))
|
||||
assert path.exists()
|
||||
|
||||
|
||||
def test_rekey_and_reopen(fresh_db, tmp_db_cfg):
|
||||
fresh_db.save_new_version(_today(), _entry("secure"), "before rekey")
|
||||
fresh_db.rekey("new-key-123")
|
||||
fresh_db.close()
|
||||
|
||||
from bouquin.db import DBManager
|
||||
|
||||
tmp_db_cfg.key = "new-key-123"
|
||||
db2 = DBManager(tmp_db_cfg)
|
||||
|
|
@ -116,12 +112,3 @@ def test_rekey_and_reopen(fresh_db, tmp_db_cfg):
|
|||
def test_compact_and_close_dont_crash(fresh_db):
|
||||
fresh_db.compact()
|
||||
fresh_db.close()
|
||||
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
def test_export_by_extension_unsupported(fresh_db, tmp_path):
|
||||
p = tmp_path / "export.xyz"
|
||||
with pytest.raises(ValueError):
|
||||
fresh_db.export_by_extension(str(p))
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import pytest
|
|||
from PySide6.QtGui import QTextCursor
|
||||
from bouquin.markdown_editor import MarkdownEditor
|
||||
from bouquin.theme import ThemeManager, ThemeConfig, Theme
|
||||
|
||||
from bouquin.find_bar import FindBar
|
||||
|
||||
@pytest.fixture
|
||||
def editor(app, qtbot):
|
||||
|
|
@ -14,9 +14,6 @@ def editor(app, qtbot):
|
|||
return ed
|
||||
|
||||
|
||||
from bouquin.find_bar import FindBar
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_findbar_basic_navigation(qtbot, editor):
|
||||
editor.from_markdown("alpha\nbeta\nalpha\nGamma\n")
|
||||
|
|
@ -42,7 +39,6 @@ def test_findbar_basic_navigation(qtbot, editor):
|
|||
|
||||
|
||||
def test_show_bar_seeds_selection(qtbot, editor):
|
||||
from PySide6.QtGui import QTextCursor
|
||||
|
||||
editor.from_markdown("alpha beta")
|
||||
c = editor.textCursor()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ from bouquin.key_prompt import KeyPrompt
|
|||
from PySide6.QtCore import QTimer
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_main_window_loads_and_saves(qtbot, app, tmp_db_cfg, fresh_db):
|
||||
s = get_settings()
|
||||
|
|
@ -52,10 +51,6 @@ def test_main_window_loads_and_saves(qtbot, app, tmp_db_cfg, fresh_db):
|
|||
|
||||
|
||||
def test_load_yesterday_todos_moves_items(qtbot, app, tmp_db_cfg, fresh_db):
|
||||
from PySide6.QtCore import QDate
|
||||
from bouquin.theme import ThemeManager, ThemeConfig, Theme
|
||||
from bouquin.settings import get_settings
|
||||
|
||||
s = get_settings()
|
||||
s.setValue("db/path", str(tmp_db_cfg.path))
|
||||
s.setValue("db/key", tmp_db_cfg.key)
|
||||
|
|
@ -66,7 +61,6 @@ def test_load_yesterday_todos_moves_items(qtbot, app, tmp_db_cfg, fresh_db):
|
|||
fresh_db.save_new_version(y, "- [ ] carry me\n- [x] done", "seed")
|
||||
|
||||
themes = ThemeManager(app, ThemeConfig(theme=Theme.LIGHT))
|
||||
from bouquin.main_window import MainWindow
|
||||
|
||||
w = MainWindow(themes=themes)
|
||||
qtbot.addWidget(w)
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import pytest
|
||||
from bouquin.db import DBManager, DBConfig
|
||||
from bouquin.key_prompt import KeyPrompt
|
||||
from bouquin.settings_dialog import SettingsDialog
|
||||
from bouquin.theme import ThemeManager, ThemeConfig, Theme
|
||||
from PySide6.QtCore import QTimer
|
||||
from PySide6.QtWidgets import QApplication, QMessageBox, QWidget
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_settings_dialog_config_roundtrip(qtbot, tmp_db_cfg, fresh_db, tmp_path):
|
||||
# Provide a parent that exposes a real ThemeManager (dialog calls parent().themes.set(...))
|
||||
|
|
@ -38,12 +39,6 @@ def test_settings_dialog_config_roundtrip(qtbot, tmp_db_cfg, fresh_db, tmp_path)
|
|||
|
||||
|
||||
def test_save_key_toggle_roundtrip(qtbot, tmp_db_cfg, fresh_db, app):
|
||||
from PySide6.QtCore import QTimer
|
||||
from PySide6.QtWidgets import QApplication, QMessageBox
|
||||
from bouquin.key_prompt import KeyPrompt
|
||||
from bouquin.theme import ThemeManager, ThemeConfig, Theme
|
||||
from PySide6.QtWidgets import QWidget
|
||||
|
||||
parent = QWidget()
|
||||
parent.themes = ThemeManager(app, ThemeConfig(theme=Theme.LIGHT))
|
||||
|
||||
|
|
@ -81,12 +76,6 @@ def test_save_key_toggle_roundtrip(qtbot, tmp_db_cfg, fresh_db, app):
|
|||
|
||||
|
||||
def test_change_key_mismatch_shows_error(qtbot, tmp_db_cfg, tmp_path, app):
|
||||
from PySide6.QtCore import QTimer
|
||||
from PySide6.QtWidgets import QApplication, QMessageBox, QWidget
|
||||
from bouquin.key_prompt import KeyPrompt
|
||||
from bouquin.db import DBManager, DBConfig
|
||||
from bouquin.theme import ThemeManager, ThemeConfig, Theme
|
||||
|
||||
cfg = DBConfig(
|
||||
path=tmp_path / "iso.db",
|
||||
key="oldkey",
|
||||
|
|
@ -129,12 +118,6 @@ def test_change_key_mismatch_shows_error(qtbot, tmp_db_cfg, tmp_path, app):
|
|||
|
||||
|
||||
def test_change_key_success(qtbot, tmp_path, app):
|
||||
from PySide6.QtCore import QTimer
|
||||
from PySide6.QtWidgets import QApplication, QWidget, QMessageBox
|
||||
from bouquin.key_prompt import KeyPrompt
|
||||
from bouquin.db import DBManager, DBConfig
|
||||
from bouquin.theme import ThemeManager, ThemeConfig, Theme
|
||||
|
||||
cfg = DBConfig(
|
||||
path=tmp_path / "iso2.db",
|
||||
key="oldkey",
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import pytest
|
|||
from PySide6.QtWidgets import QWidget
|
||||
from bouquin.markdown_editor import MarkdownEditor
|
||||
from bouquin.theme import ThemeManager, ThemeConfig, Theme
|
||||
from bouquin.toolbar import ToolBar
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
@ -12,10 +13,6 @@ def editor(app, qtbot):
|
|||
ed.show()
|
||||
return ed
|
||||
|
||||
|
||||
from bouquin.toolbar import ToolBar
|
||||
|
||||
|
||||
@pytest.mark.gui
|
||||
def test_toolbar_signals_and_styling(qtbot, editor):
|
||||
host = QWidget()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue