diff options
Diffstat (limited to 'test/test_config/test_option.py')
-rw-r--r-- | test/test_config/test_option.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/test/test_config/test_option.py b/test/test_config/test_option.py new file mode 100644 index 0000000..3fc9e6f --- /dev/null +++ b/test/test_config/test_option.py | |||
@@ -0,0 +1,53 @@ | |||
1 | # Copyright (C) 2010 Leonard Thomas | ||
2 | # | ||
3 | # This file is part of Dodai. | ||
4 | # | ||
5 | # Dodai is free software: you can redistribute it and/or modify | ||
6 | # it under the terms of the GNU General Public License as published by | ||
7 | # the Free Software Foundation, either version 3 of the License, or | ||
8 | # (at your option) any later version. | ||
9 | # | ||
10 | # Dodai is distributed in the hope that it will be useful, | ||
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | # GNU General Public License for more details. | ||
14 | # | ||
15 | # You should have received a copy of the GNU General Public License | ||
16 | # along with Dodai. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | import unittest | ||
19 | from dodai.config.option import ConfigOption | ||
20 | from optparse import OptionParser | ||
21 | |||
22 | class TestConfigOption(unittest.TestCase): | ||
23 | |||
24 | def setUp(self): | ||
25 | self.obj = ConfigOption() | ||
26 | |||
27 | def test_parser(self): | ||
28 | self.assertTrue(isinstance(self.obj.parser, OptionParser)) | ||
29 | |||
30 | def test_add_quiet(self): | ||
31 | self.obj.add_quiet() | ||
32 | self.assertTrue(self.obj.parser.has_option('-q')) | ||
33 | |||
34 | def test_add_verbose(self): | ||
35 | self.obj.add_verbose() | ||
36 | self.assertTrue(self.obj.parser.has_option('-v')) | ||
37 | |||
38 | def test_add_log_level(self): | ||
39 | self.obj.add_log_level('critical') | ||
40 | self.assertTrue(self.obj.parser.has_option('-l')) | ||
41 | |||
42 | def test_add_setup(self): | ||
43 | self.obj.add_setup() | ||
44 | self.assertTrue(self.obj.parser.has_option('--setup')) | ||
45 | |||
46 | def test_get_args(self): | ||
47 | args = self.obj.get_args() | ||
48 | self.assertTrue(args == []) | ||
49 | |||
50 | def test_get_options(self): | ||
51 | self.obj.add_quiet() | ||
52 | options = self.obj.get_options() | ||
53 | self.assertTrue(options.verbose == True) | ||