fix: remove extra quote when executing a note indexation and update deps

This commit is contained in:
cătălin 2023-11-17 13:31:50 +01:00
commit 67595b3220
Signed by: catalin
GPG key ID: 686088EF78EE4083
11 changed files with 228 additions and 305 deletions

View file

@ -29,6 +29,7 @@ def notes(notebooks_path: Path):
dt = dt.subtract(days=day_offset)
(dailies / f"{dt.date()}.age").touch()
@pytest.fixture()
def unencrypted_notes(notebooks_path):
unencrypted_root_path = notebooks_path / "unencrypted"

View file

@ -4,15 +4,18 @@ from pathlib import Path
from halig.commands.import_unencrypted import ImportCommand
from halig.encryption import Encryptor
@pytest.fixture()
def command(settings) -> ImportCommand:
return ImportCommand(settings)
def test_get_importables(unencrypted_notes: Path, command: ImportCommand):
notes = list(command.get_importables())
assert len(notes) == 15
assert notes == list(unencrypted_notes.glob("**/*.md"))
def test_import(unencrypted_notes: Path, command: ImportCommand, encryptor: Encryptor):
command.run()
notes = command.get_importables()
@ -23,11 +26,16 @@ def test_import(unencrypted_notes: Path, command: ImportCommand, encryptor: Encr
encrypted_data = f.read()
data = encryptor.decrypt(encrypted_data)
if "inner" in str(note):
assert f'sub{note.name.replace(".age", "").replace("_"," ")}' == data.decode()
assert (
f'sub{note.name.replace(".age", "").replace("_"," ")}' == data.decode()
)
else:
assert note.name.replace(".age", "").replace("_"," ") == data.decode()
assert note.name.replace(".age", "").replace("_", " ") == data.decode()
def test_import_unlink(unencrypted_notes: Path, command: ImportCommand, encryptor: Encryptor):
def test_import_unlink(
unencrypted_notes: Path, command: ImportCommand, encryptor: Encryptor
):
command.unlink = True
command.run()
notes = command.get_importables()

View file

@ -8,7 +8,7 @@ def reencrypt_command(settings):
return ReencryptCommand(settings)
@pytest.mark.usefixtures('notes')
@pytest.mark.usefixtures("notes")
def test_reencrypt(reencrypt_command):
reencrypt_command.run()
for note_path in reencrypt_command.traverse():