feat: move edit_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
c25156fe4c
commit
75d623a124
10 changed files with 191 additions and 42 deletions
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue