aboutsummaryrefslogtreecommitdiff
path: root/pocketbook/tests/test_panel.py
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-26 14:05:40 -0500
committerCraig Jennings <c@cjennings.net>2026-05-26 14:05:40 -0500
commit70e89e946cbdff307284d11a46558161f713607c (patch)
treec305ce9249fac0aef1318f5caabae0df31be7e95 /pocketbook/tests/test_panel.py
parent92f4a9394ae1b662d037a3016e94058a3881bdb8 (diff)
downloadarchsetup-70e89e946cbdff307284d11a46558161f713607c.tar.gz
archsetup-70e89e946cbdff307284d11a46558161f713607c.zip
refactor: fold pocketbook in-tree and drop its install steps
Pocketbook is nowhere near ready, so I pulled it back from publication: deleted the github mirror and the cjennings.net repo, removed the server mirror hook, and copied the package into pocketbook/ here until it's ready to spin back out. Dropped the steps that provisioned it on a fresh install: the gtk4-layer-shell dep and the pip install in archsetup, and the clone in post-install.sh. That clone pointed at the now-deleted github repo, so it would have failed a fresh run regardless. Re-wiring the install is tracked in the pocketbook backlog.
Diffstat (limited to 'pocketbook/tests/test_panel.py')
-rw-r--r--pocketbook/tests/test_panel.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/pocketbook/tests/test_panel.py b/pocketbook/tests/test_panel.py
new file mode 100644
index 0000000..92f8648
--- /dev/null
+++ b/pocketbook/tests/test_panel.py
@@ -0,0 +1,40 @@
+from unittest.mock import MagicMock
+from pocketbook.note import Note
+
+
+class TestPanelController:
+ """Test panel controller logic with a mocked store."""
+
+ def _make_controller(self):
+ from pocketbook.panel import PanelController
+ store = MagicMock()
+ controller = PanelController(store)
+ return controller, store
+
+ def test_add_note_calls_store_create(self):
+ controller, store = self._make_controller()
+ store.create.return_value = "0001-20260101-120000-abc12.txt"
+ controller.add_note()
+ store.create.assert_called_once_with("New Note", "")
+
+ def test_delete_note_calls_store_delete(self):
+ controller, store = self._make_controller()
+ controller.delete_note("0001-20260101-120000-abc12.txt")
+ store.delete.assert_called_once_with("0001-20260101-120000-abc12.txt")
+
+ def test_update_note_calls_store_update(self):
+ controller, store = self._make_controller()
+ controller.update_note("0001-20260101-120000-abc12.txt", "New Title", "New Body")
+ store.update.assert_called_once_with(
+ "0001-20260101-120000-abc12.txt", "New Title", "New Body"
+ )
+
+ def test_get_notes_calls_store_list(self):
+ controller, store = self._make_controller()
+ store.list_notes.return_value = [
+ ("0001-20260101-120000-abc12.txt", Note(title="A", body="a")),
+ ]
+ notes = controller.get_notes()
+ store.list_notes.assert_called_once()
+ assert len(notes) == 1
+ assert notes[0][1].title == "A"