From 0b303ba68c19e38a4487de59df0fdc93c6dd48cf Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Mon, 9 Nov 2026 18:11:02 +0100 Subject: feat: scaffold and config --- tests/test_config.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/test_config.py (limited to 'tests') 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() -- cgit v1.2.3