diff options
Diffstat (limited to 'tests/test_config.py')
| -rw-r--r-- | tests/test_config.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index 879917c..928a8e8 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -35,11 +35,19 @@ class Config(unittest.TestCase): def test_rejects_bad_values(self): bad = [{"display": {"name": "TAB;rm"}}, {"display": {"refresh": 0}}, + {"display": {"enabled": "no"}}, {"ports": {"command_center": 80}}, - {"ports": {"command_center": 5900, "display": 5900}}] + {"ports": {"command_center": 5900, "display": 5900}}, + {"wifi": {"address": "x; rm -rf ~"}}, + {"launch": {"apps": ["ok", "../evil"]}}] for cfg in bad: self.assertIsNotNone(config.config_error(cfg), cfg) + def test_user_file_overrides_key_by_key(self): + cfg = config.merge({"display": {"enabled": True, "scale": 1}, "launch": {"apps": ["a", "b"]}}, + {"display": {"enabled": False}, "launch": {"apps": ["c"]}}) + self.assertEqual(cfg, {"display": {"enabled": False, "scale": 1}, "launch": {"apps": ["c"]}}) + 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") |
