diff options
Diffstat (limited to 'test/test_config.py')
| -rw-r--r-- | test/test_config.py | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/test/test_config.py b/test/test_config.py index a9d3f54..cb202be 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -1,17 +1,22 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -# Copyright 2015-2019 Mike Fährmann +# Copyright 2015-2020 Mike Fährmann # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License version 2 as # published by the Free Software Foundation. -import unittest -import gallery_dl.config as config import os +import sys +import unittest + +import json import tempfile +sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +from gallery_dl import config # noqa E402 + class TestConfig(unittest.TestCase): @@ -137,5 +142,25 @@ class TestConfig(unittest.TestCase): self.assertEqual(config.get(("b",), "e"), "foo") +class TestConfigFiles(unittest.TestCase): + + def test_default_config(self): + cfg = self._load("gallery-dl.conf") + self.assertIsInstance(cfg, dict) + self.assertTrue(cfg) + + def test_example_config(self): + cfg = self._load("gallery-dl-example.conf") + self.assertIsInstance(cfg, dict) + self.assertTrue(cfg) + + @staticmethod + def _load(name): + rootdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + path = os.path.join(rootdir, "docs", name) + with open(path) as fp: + return json.load(fp) + + if __name__ == '__main__': unittest.main() |
