diff test/test_indexer.py @ 6356:c26b9ce33ae3

issue2551123 - validate indexer_language in configuration.py Was validated in backends/indexer_xapian.py which would throw an error on access rather than on start. Added validator function to CoreConfig class that runs after config.ini is read. At this time we have access to the indexer setting so can determine if xapian is actually going to be used. Moved test into test/test_config.py and pulled validation code from indexer_xapian.py and test/test_indexer.py.
author John Rouillard <rouilj@ieee.org>
date Mon, 29 Mar 2021 22:47:54 -0400
parents 9d209d2b34ae
children 91ab3e0ffcd0
line wrap: on
line diff
--- a/test/test_indexer.py	Mon Mar 29 20:43:22 2021 -0400
+++ b/test/test_indexer.py	Mon Mar 29 22:47:54 2021 -0400
@@ -195,26 +195,6 @@
         self.dex = Indexer(db)
     def tearDown(self):
         shutil.rmtree('test-index')
-    def test_invalid_language(self):
-        """ make sure we have a reasonable error message if
-            invalid language is specified """
-        l = db.config[('main', 'indexer_language')]
-        db.config[('main', 'indexer_language')] = "NO_LANG"
-        from roundup.backends.indexer_xapian import Indexer
-        with self.assertRaises(ValueError) as cm:
-            Indexer(db)
-        # note if Indexer(db) doesn't return ValueError
-        # all Xapian tests after this point will fail.
-        # because a valid langage will not be set.
-        # reset the valid language.
-        db.config[('main', 'indexer_language')] =  l
-
-        print(cm)
-        self.assertIn("ValueError", repr(cm.exception))
-        # look for failing language
-        self.assertIn("NO_LANG", cm.exception.args[0])
-        # look for supported language
-        self.assertIn("english", cm.exception.args[0])
 
 class RDBMSIndexerTest(object):
     def setUp(self):

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