feat: make the inclusion of each notebook's note optional via --include-notes when listing notebooks
This commit is contained in:
parent
a591fe20e8
commit
3d93be39d6
8 changed files with 632 additions and 512 deletions
|
|
@ -25,12 +25,14 @@ def test_build_tree_max_depth_2(notes, notebooks_command: NotebooksCommand):
|
|||
work = tree.children[1]
|
||||
assert personal.label == "Personal"
|
||||
assert work.label == "Work"
|
||||
assert len(work.children) == 2
|
||||
assert len(personal.children) == 1
|
||||
assert len(work.children) == 1
|
||||
assert len(personal.children) == 0
|
||||
|
||||
|
||||
def test_build_tree_max_depth_inf(notes, notebooks_command: NotebooksCommand):
|
||||
tree = notebooks_command.build_tree(notebooks_command.settings.notebooks_root_path)
|
||||
def test_build_tree_max_depth_inf(notes, settings):
|
||||
tree = NotebooksCommand(max_depth=float("inf"), settings=settings, include_notes=True).build_tree(
|
||||
settings.notebooks_root_path
|
||||
)
|
||||
personal = tree.children[0]
|
||||
work = tree.children[1]
|
||||
assert personal.label == "Personal"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from halig import utils
|
||||
from halig.commands.reencrypt import ReencryptCommand
|
||||
|
||||
|
||||
|
|
@ -14,3 +15,11 @@ def test_reencrypt(reencrypt_command):
|
|||
for note_path in reencrypt_command.traverse():
|
||||
with note_path.open("rb") as f:
|
||||
assert reencrypt_command.encryptor.decrypt(f.read()) == b""
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("current_daily")
|
||||
def test_reencrypt_warns_no_matching_key(reencrypt_command, halig_ssh_path, capfd):
|
||||
reencrypt_command.encryptor.identities = []
|
||||
reencrypt_command.run()
|
||||
out, _ = capfd.readouterr()
|
||||
assert f'because no matching keys were found, skipping ...' in out
|
||||
|
|
|
|||
|
|
@ -41,22 +41,6 @@ def ssh_recipient(halig_ssh_public_key: str) -> Recipient:
|
|||
return Recipient.from_str(halig_ssh_public_key)
|
||||
|
||||
|
||||
# @pytest.fixture()
|
||||
# def halig_path(fs, halig_ssh_public_key, halig_ssh_private_key) -> Path:
|
||||
# fs.add_real_paths(["/etc/localtime"])
|
||||
# ssh_path = Path("~/.ssh").expanduser()
|
||||
# ssh_path.mkdir(parents=True)
|
||||
#
|
||||
# with (ssh_path / "id_ed25519").open("w") as f:
|
||||
# f.write(halig_ssh_private_key)
|
||||
#
|
||||
# with (ssh_path / "id_ed25519.pub").open("w") as f:
|
||||
# f.write(halig_ssh_public_key)
|
||||
#
|
||||
# halig_path = Path("~/.config/halig").expanduser()
|
||||
# halig_path.mkdir(parents=True)
|
||||
# return halig_path
|
||||
|
||||
@pytest.fixture()
|
||||
def halig_ssh_path(tmp_path: Path, halig_ssh_public_key, halig_ssh_private_key) -> Path:
|
||||
ssh_path = tmp_path / ".ssh"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue