feat: move new_note function to a separate file
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
cătălin 2022-08-28 15:35:37 +02:00
commit 3d053d532a
Signed by: catalin
GPG key ID: 0178DF42F43E5FD2
12 changed files with 239 additions and 105 deletions

View file

@ -4,7 +4,7 @@ from subprocess import CalledProcessError
import pytest
from halig.config import Config, EncryptionKeysConfig
from halig.edit import edit_note
from halig.edit_note import edit_note
from halig.exceptions import CouldNotEditTempfile
from tests.file_fixtures import tmpfile, tempfile # noqa: F401
@ -60,20 +60,20 @@ def test_edit_note(config: Config, mocker): # noqa: F811
mocker.patch("subprocess.call", side_effect=mock_subprocess)
edit_note(config.notes_root_path / "note.age", config)
assert (
age(
"-d",
"-i",
config.encryption_keys.private_key_path,
config.notes_root_path / "note.age",
)
== "mocked"
age(
"-d",
"-i",
config.encryption_keys.private_key_path,
config.notes_root_path / "note.age",
)
== "mocked"
)
def test_edit_not_raises_could_not_edit_tempfile(config: Config, mocker): # noqa: F811
mocker.patch("subprocess.call", side_effect=CalledProcessError(
returncode=1,
cmd="foo",
output="mocked error"))
mocker.patch(
"subprocess.call",
side_effect=CalledProcessError(returncode=1, cmd="foo", output="mocked error"),
)
with pytest.raises(CouldNotEditTempfile):
edit_note(config.notes_root_path / "note.age", config)