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

@ -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()