aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-11-09 18:11:02 +0100
committerDanilo M. <danix@danix.xyz>2026-11-09 18:11:02 +0100
commit0b303ba68c19e38a4487de59df0fdc93c6dd48cf (patch)
treea052ffeeb1eed0780d6f90c9a2539ae930344444 /tests
parent4b98da80bdfd5016ad9f5858310d4b8bacafe7bb (diff)
downloaddeck-it-0b303ba68c19e38a4487de59df0fdc93c6dd48cf.tar.gz
deck-it-0b303ba68c19e38a4487de59df0fdc93c6dd48cf.zip
feat: scaffold and config
Diffstat (limited to 'tests')
-rw-r--r--tests/test_config.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_config.py b/tests/test_config.py
new file mode 100644
index 0000000..ff56325
--- /dev/null
+++ b/tests/test_config.py
@@ -0,0 +1,33 @@
+# tests/test_config.py
+import sys
+from pathlib import Path
+
+ROOT = Path(__file__).resolve().parent.parent
+sys.path.insert(0, str(ROOT))
+
+import tomllib
+import unittest
+
+import deckit.config as config
+
+
+class Config(unittest.TestCase):
+ def test_default_config_is_valid(self):
+ with open(ROOT / "config.toml", "rb") as f:
+ self.assertIsNone(config.config_error(tomllib.load(f)))
+
+ def test_rejects_bad_values(self):
+ bad = [{"display": {"name": "TAB;rm"}},
+ {"display": {"refresh": 0}},
+ {"ports": {"command_center": 80}},
+ {"ports": {"command_center": 5900, "display": 5900}}]
+ for cfg in bad:
+ self.assertIsNotNone(config.config_error(cfg), cfg)
+
+ def test_user_config_path_honours_xdg(self):
+ self.assertEqual(config.user_config_path().name, "config.toml")
+ self.assertEqual(config.user_config_path().parent.name, "deck-it")
+
+
+if __name__ == "__main__":
+ unittest.main()