feat: move new_note function to a separate file
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
75d623a124
commit
3d053d532a
12 changed files with 239 additions and 105 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue