diff tests/test.py @ 412:816327e178b0

Provide coercing methods for the jailed configuration: getintXXX(), getboolXXX(), getfloatXXX() and friends. This is done be refactoring Configuration and putting the coercing methods into a common mixin.
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 20 Nov 2021 13:52:08 +0100
parents 1bec7f5fafe8
children 2abde0d3c735
line wrap: on
line diff
--- a/tests/test.py	Fri Nov 19 15:52:01 2021 +0100
+++ b/tests/test.py	Sat Nov 20 13:52:08 2021 +0100
@@ -1431,6 +1431,14 @@
         # base is not because rebind() failed
         self.assertTrue(cfg is jcfg1.base)
 
+    def test_getbool(self):
+        cfg = configmix.load(os.path.join(TESTDATADIR, "conf10.py"))
+        jcfg = cfg.jailed(rootpath=(u"tree1", u"tree2"))
+
+        self.assertFalse(jcfg.getboolvar_s(u"key6"))
+        self.assertEqual(u"off", jcfg.getvarl_s(u"key6"))
+        self.assertTrue(jcfg.getvar_s(u"key6"))
+
 
 if __name__ == "__main__":
     unittest.main()