mirror of
https://github.com/aclist/dztui.git
synced 2026-10-25 12:12:31 +01:00
chore: add config test
This commit is contained in:
1 parent
a2aeac0242
commit
8695793af4
2 files changed
+16
-3
No files matched your search
@@ -107,6 +107,7 @@ config-settings-package = { pygobject-stubs = { config = "Gtk3,Gdk3,Soup2" } }
|
|||||||
[tool.pytest.ini_options]
|
[tool.pytest.ini_options]
|
||||||
markers = [
|
markers = [
|
||||||
"config: config file keys/values",
|
"config: config file keys/values",
|
||||||
|
"mods: tests mod metadata/link creation",
|
||||||
"pefile: validate PE files",
|
"pefile: validate PE files",
|
||||||
"post_install: requires a completed installation",
|
"post_install: requires a completed installation",
|
||||||
"slow: long-running tests",
|
"slow: long-running tests",
|
||||||
|
|||||||
+15
-3
@@ -1,6 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from dzgui.const.boilerplate import config_boilerplate
|
||||||
from dzgui.config.query import get_config
|
from dzgui.config.query import get_config
|
||||||
from dzgui.config.xdg import get_xdg_paths, parse_filepaths
|
from dzgui.config.xdg import get_xdg_paths, parse_filepaths
|
||||||
from dzgui.config import convert
|
from dzgui.config import convert
|
||||||
@@ -11,7 +12,11 @@ pytestmark = pytest.mark.config
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def legacy_config():
|
def legacy_config():
|
||||||
return fixture_path("dztuirc_one")
|
return fixture_path("dztuirc_1")
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def unset_values():
|
||||||
|
return fixture_path("dztuirc_3")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
@@ -60,8 +65,8 @@ def test_contains_invalid_values(keys, config):
|
|||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"fixture, expect",
|
"fixture, expect",
|
||||||
[
|
[
|
||||||
("dztuirc_one", (False, True, True)),
|
("dztuirc_1", (False, True, True)),
|
||||||
("dztuirc_two", (False, False, False)),
|
("dztuirc_2", (False, False, False)),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_bool_conversion(fixture, expect):
|
def test_bool_conversion(fixture, expect):
|
||||||
@@ -86,5 +91,12 @@ def test_key_conversion(legacy_config):
|
|||||||
for key in keys:
|
for key in keys:
|
||||||
assert key not in j
|
assert key not in j
|
||||||
|
|
||||||
|
def test_missing_values(unset_values):
|
||||||
|
j = convert.rc2json(unset_values)
|
||||||
|
j = json.loads(j)
|
||||||
|
assert j.keys() == config_boilerplate.keys()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# TODO: test that when a config file is created from scratch, it contains all values
|
# TODO: test that when a config file is created from scratch, it contains all values
|
||||||
Reference in new issue
Block a user