feat: move edit_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 12:12:31 +02:00
commit 75d623a124
Signed by: catalin
GPG key ID: 0178DF42F43E5FD2
10 changed files with 191 additions and 42 deletions

View file

@ -1,5 +1,3 @@
import shutil
import tempfile
from pathlib import Path
from tempfile import NamedTemporaryFile
@ -8,21 +6,7 @@ import yaml
from halig.config import get_config, Config, EncryptionKeysConfig
from halig.exceptions import ConfigFileDoesNotExist, ConfigFileIsInvalid
@pytest.fixture()
def tmpfile():
_tmpfile = NamedTemporaryFile(delete=False)
with open(_tmpfile.name, "w") as file:
yield file
Path(_tmpfile.name).unlink()
@pytest.fixture()
def tmpdir():
tmpdir = Path(tempfile.mkdtemp())
yield tmpdir
shutil.rmtree(tmpdir)
from tests.file_fixtures import tmpfile, tmpdir # noqa: 401
def test_get_config_raises_config_file_does_not_exist():
@ -36,19 +20,19 @@ def test_get_config_with_empty_file_raises_invalid_config_file():
get_config(Path(f.name))
def test_get_config_raises_invalid_config_file_00(tmpfile):
def test_get_config_raises_invalid_config_file_00(tmpfile): # noqa: F811
tmpfile.write("foobar")
with pytest.raises(ConfigFileIsInvalid):
get_config(Path(tmpfile.name))
def test_get_config_raises_invalid_config_file_01(tmpfile):
def test_get_config_raises_invalid_config_file_01(tmpfile): # noqa: F811
yaml.dump({"foo": "bar"}, tmpfile, Dumper=yaml.SafeDumper)
with pytest.raises(ConfigFileIsInvalid):
get_config(Path(tmpfile.name))
def test_get_config(tmpdir):
def test_get_config(tmpdir): # noqa: F811
notes_root_path = Path(tmpdir / "notes")
notes_root_path.mkdir(exist_ok=True)
age_binary_path = Path(tmpdir / "age")