diff test/test_config.py @ 6359:2d42a308927b

Test trying to load missing config.ini file. Noticed this case wasn't covered by tests. Low hanging fruit.
author John Rouillard <rouilj@ieee.org>
date Tue, 30 Mar 2021 02:39:48 -0400
parents 42db48c30d31
children 08e209a7f22b
line wrap: on
line diff
--- a/test/test_config.py	Tue Mar 30 02:24:22 2021 -0400
+++ b/test/test_config.py	Tue Mar 30 02:39:48 2021 -0400
@@ -420,6 +420,23 @@
         self.assertEqual(config[('web','cookie_takes_precedence')], 0)
 
 
+    def testLoadConfigNoConfig(self):
+        """ run load on a directory missing config.ini """
+
+        c = os.path.join(self.dirname, configuration.Config.INI_FILE)
+        if os.path.exists(c):
+            os.remove(c)
+        else:
+            self.assertFalse("setup failed missing config.ini")
+
+        config = configuration.CoreConfig()
+        
+        with self.assertRaises(configuration.NoConfigError) as cm:
+            config.load(self.dirname)
+
+        print(cm.exception)
+        self.assertEqual(cm.exception.args[0], self.dirname)
+
     def testInvalidIndexerValue(self):
         """ Mistype native indexer. Verify exception is
             generated.

Roundup Issue Tracker: http://roundup-tracker.org/