cubicweb/test/unittest_cwconfig.py
changeset 11929 fcbd6b251d81
parent 11920 f13799fbcfea
parent 11859 2e1a1ebd4730
child 11966 fe995d56c949
--- a/cubicweb/test/unittest_cwconfig.py	Mon Jan 23 15:35:19 2017 +0100
+++ b/cubicweb/test/unittest_cwconfig.py	Fri Jan 27 16:26:09 2017 +0100
@@ -247,7 +247,7 @@
         from cubes import file
         self.assertEqual(file.__path__, [join(self.custom_cubes_dir, 'file')])
 
-    def test_config_value_from_environment(self):
+    def test_config_value_from_environment_str(self):
         self.assertIsNone(self.config['base-url'])
         os.environ['CW_BASE_URL'] = 'https://www.cubicweb.org'
         try:
@@ -256,6 +256,24 @@
         finally:
             del os.environ['CW_BASE_URL']
 
+    def test_config_value_from_environment_int(self):
+        self.assertEqual(self.config['connections-pool-size'], 4)
+        os.environ['CW_CONNECTIONS_POOL_SIZE'] = '6'
+        try:
+            self.assertEqual(self.config['connections-pool-size'], 6)
+        finally:
+            del os.environ['CW_CONNECTIONS_POOL_SIZE']
+
+    def test_config_value_from_environment_yn(self):
+        self.assertEqual(self.config['allow-email-login'], False)
+        try:
+            for val, result in (('yes', True), ('no', False),
+                                ('y', True), ('n', False),):
+                os.environ['CW_ALLOW_EMAIL_LOGIN'] = val
+            self.assertEqual(self.config['allow-email-login'], result)
+        finally:
+            del os.environ['CW_ALLOW_EMAIL_LOGIN']
+            
 
 class FindPrefixTC(unittest.TestCase):