summaryrefslogtreecommitdiffstats
path: root/tests/unit/test-014-conf-and-raw.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-06-09 16:49:36 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2014-06-09 16:50:15 +0200
commit4b1f0279d79478555d9d568a58199759296a7b2e (patch)
treeb46d1583387dcf97898e0c46d41a3e162e269141 /tests/unit/test-014-conf-and-raw.py
parent4825f5d6ae9b9c4266d4b694d6fda1c71a7f04a1 (diff)
downloadpykolab-4b1f0279d79478555d9d568a58199759296a7b2e.tar.gz
Tests setting and getting items with '%' in it (#3099)
Diffstat (limited to 'tests/unit/test-014-conf-and-raw.py')
-rw-r--r--tests/unit/test-014-conf-and-raw.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/unit/test-014-conf-and-raw.py b/tests/unit/test-014-conf-and-raw.py
new file mode 100644
index 0000000..677cb2f
--- /dev/null
+++ b/tests/unit/test-014-conf-and-raw.py
@@ -0,0 +1,38 @@
+# -*- 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()