feat: add -c/--config flag to every command

This commit is contained in:
cătălin 2023-03-04 23:16:00 +02:00
commit 6f45b76579
Signed by: catalin
GPG key ID: 686088EF78EE4083
10 changed files with 163 additions and 51 deletions

View file

@ -8,18 +8,26 @@ from halig.settings import Settings
def test_show_raises_note_path_does_not_exist(notes, settings: Settings):
with pytest.raises(ValueError, match="does not exist"):
ShowCommand(Path('foo'), settings=settings, )
ShowCommand(
Path("foo"),
settings=settings,
)
def test_show_raises_note_path_is_not_age_valid(notes, settings: Settings):
note_path = settings.notebooks_root_path / "foo.txt"
note_path.touch()
with pytest.raises(ValueError, match="is not a valid AGE file"):
ShowCommand(note_path, settings=settings, )
ShowCommand(
note_path,
settings=settings,
)
def test_show_current_note(current_note, settings):
show_command = ShowCommand(note_path=settings.notebooks_root_path, settings=settings)
show_command = ShowCommand(
note_path=settings.notebooks_root_path, settings=settings
)
assert show_command.note_path == current_note
assert show_command.decrypt() == "foo"