Mercurial > p > roundup > code
diff test/test_config.py @ 6358:42db48c30d31
Validate indexer values
Make sure that indexer values are one of the supported indexers.
Invalid values would have raised an invalid indexer exception on
access.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 30 Mar 2021 02:24:22 -0400 |
| parents | c985ed52ca2d |
| children | 2d42a308927b |
line wrap: on
line diff
--- a/test/test_config.py Tue Mar 30 02:10:00 2021 -0400 +++ b/test/test_config.py Tue Mar 30 02:24:22 2021 -0400 @@ -381,7 +381,7 @@ self.assertEqual(config['INDEXER_LANGUAGE'], 'NO_LANG') def testInvalidIndexerLanguage_w_xapian(self): - """ Use explicit xapian indexer. VAerify exception is + """ Use explicit xapian indexer. Verify exception is generated. """ @@ -418,3 +418,23 @@ # uppercase name passes as does tuple index for setting in web self.assertEqual(config['WEB_COOKIE_TAKES_PRECEDENCE'], 0) self.assertEqual(config[('web','cookie_takes_precedence')], 0) + + + def testInvalidIndexerValue(self): + """ Mistype native indexer. Verify exception is + generated. + """ + + print("Testing indexer nati") + + self.munge_configini(mods=[ ("indexer = ", "nati") ]) + + with self.assertRaises(configuration.OptionValueError) as cm: + config.load(self.dirname) + + self.assertIn("OptionValueError", repr(cm.exception)) + # look for failing value + self.assertEqual("nati", cm.exception.args[1]) + # look for supported values + self.assertIn("whoosh", cm.exception.args[2]) +
