summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-014-conf-and-raw.py
blob: e7f0ba613bb03a66faace6af3c179b44a88cf6a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-

import os
import pykolab
import tempfile
import unittest

conf = pykolab.getConf()
conf.finalize_conf(fatal=False)


class TestConfRaw(unittest.TestCase):
    config_file = None

    @classmethod
    def setup_class(self, *args, **kw):
        (fp, self.config_file) = tempfile.mkstemp()
        os.write(fp, '[kolab]\n')
        os.close(fp)
        conf.read_config(self.config_file)

    @classmethod
    def teardown_class(self, *args, **kw):
        os.remove(self.config_file)

    def test_001_set(self):
        password = '$%something'
        conf.command_set('kolab', 'test_password', password)

    def test_002_get(self):
        password = conf.get('kolab', 'test_password')
        self.assertEqual('$%something', password)

    def test_003_get_raw(self):
        password = conf.get_raw('kolab', 'test_password')
        self.assertNotEqual('$%something', password)

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