aboutsummaryrefslogtreecommitdiff
path: root/test/test_config/test_init.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_config/test_init.py')
-rw-r--r--test/test_config/test_init.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/test_config/test_init.py b/test/test_config/test_init.py
new file mode 100644
index 0000000..92b44c6
--- /dev/null
+++ b/test/test_config/test_init.py
@@ -0,0 +1,62 @@
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
18import unittest
19from dodai.config import Config
20from dodai.config.option import ConfigOption
21from dodai.config.file import ConfigFile
22from dodai.config.log import ConfigLog
23from dodai.config import ConfigResults
24from dodai.config.db import ConfigDb
25
26class TestConfig(unittest.TestCase):
27
28 def setUp(self):
29 self.obj = Config()
30
31 def test_set_one(self):
32 self.obj.set('foo', 'bar')
33 self.assertTrue('foo' in self.obj.vars.keys())
34
35 def test_set_two(self):
36 self.obj.set('foo', 'bar')
37 self.assertTrue('bar' == self.obj.vars['foo'])
38
39 def test_options(self):
40 obj = self.obj.options()
41 self.assertTrue(isinstance(obj, ConfigOption))
42
43 def test_files(self):
44 obj = self.obj.files()
45 self.assertTrue(isinstance(obj, ConfigFile))
46
47 def test_logs(self):
48 obj = self.obj.logs()
49 self.assertTrue(isinstance(obj, ConfigLog))
50
51 def test_call_one(self):
52 obj = self.obj()
53 self.assertTrue(isinstance(obj, ConfigResults))
54
55 def test_call_two(self):
56 self.obj.set('foo', 'bar')
57 obj = self.obj()
58 self.assertTrue(obj.foo == 'bar')
59
60 def test_db_one(self):
61 obj = self.obj.dbs()
62 self.assertTrue(isinstance(obj, ConfigDb))