test_config.py 1.48 KB
Newer Older
1
# Topydo - A todo.txt client written in Python.
2
# Copyright (C) 2014 - 2015 Bram Schoenmakers <me@bramschoenmakers.nl>
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import unittest

19
from test.topydo_testcase import TopydoTest
MinchinWeb's avatar
MinchinWeb committed
20
from topydo.lib.Config import config
21

MinchinWeb's avatar
MinchinWeb committed
22

Bram Schoenmakers's avatar
Bram Schoenmakers committed
23
class ConfigTest(TopydoTest):
24
    def test_config1(self):
25
        self.assertEqual(config("test/data/config1").default_command(), 'do')
26 27

    def test_config2(self):
28
        self.assertNotEqual(config("").default_command(), 'do')
29 30

    def test_config3(self):
31 32
        self.assertTrue(config("test/data/config2").ignore_weekends())

33 34 35 36 37 38 39 40
    def test_config4(self):
        """ Test that value in file is overridden by parameter. """
        overrides = {
            ('topydo', 'default_command'): 'edit'
        }

        self.assertEqual(config("test/data/config1", p_overrides=overrides).default_command(), 'edit')

41 42
if __name__ == '__main__':
    unittest.main()