mirror of
https://github.com/aclist/dztui.git
synced 2026-10-25 12:12:31 +01:00
fix: copy bare config files to named directory (#375)
This commit is contained in:
1 parent
cd1fd1b179
commit
61f90d6016
3 files changed
+74
-5
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import pytest
|
||||
import tempfile
|
||||
|
||||
from dzgui.app_init import copy_bare_configs
|
||||
from pathlib import Path
|
||||
|
||||
@pytest.mark.mods
|
||||
def test_bare_file_import():
|
||||
conf_string = "DZGUI_CONF\n"
|
||||
state_string = "DZGUI_STATE\n"
|
||||
state = [
|
||||
"dzg.history",
|
||||
"dzg.versions",
|
||||
"dzg.res.json",
|
||||
"dzg.filters.json",
|
||||
"dzg.columns.json",
|
||||
"dzg.notes.json",
|
||||
"ips.csv",
|
||||
".month"
|
||||
]
|
||||
|
||||
tmp = tempfile.TemporaryDirectory()
|
||||
tmp2 = tempfile.TemporaryDirectory()
|
||||
tmp_conf = Path(tmp.name)
|
||||
tmp_state = Path(tmp2.name)
|
||||
|
||||
tmp_conf_file = tmp_conf / "config.json"
|
||||
tmp_conf_file.write_text(conf_string)
|
||||
for file in state:
|
||||
tmp_state.joinpath(file).write_text(state_string)
|
||||
|
||||
tmp_state_file = tmp_state / "dzg.res.json"
|
||||
copy_bare_configs(tmp_conf_file, tmp_state_file)
|
||||
|
||||
assert (tmp_conf / "dzgui/config.json").read_text() == conf_string
|
||||
for file in state:
|
||||
assert (tmp_state / "dzgui" / file).read_text() == state_string
|
||||
Reference in new issue
Block a user