summaryrefslogtreecommitdiff
path: root/tests/test_collection.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_collection.py')
-rw-r--r--tests/test_collection.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_collection.py b/tests/test_collection.py
index 9522ab8..7d2dc72 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -43,6 +43,18 @@ class testCollectionLoading(unittest.TestCase):
self.assertIsNotNone(self.collection.settings)
self.assertIsNotNone(self.collection.stemmer)
+ def test_no_index_for_one_entry(self):
+ # This loads a collection where some of the entries have no
+ # "index" field
+ with self.assertLogs(level=logging.WARNING) as cm:
+ self.collection = lesana.Collection('tests/data/wrong')
+ self.collection.update_cache()
+ self.assertIsNotNone(self.collection.settings)
+ self.assertIsNotNone(self.collection.stemmer)
+ # Fields with no "index" entry are not indexed
+ self.assertEqual(len(self.collection.settings['fields']), 3)
+ self.assertEqual(len(self.collection.indexed_fields), 1)
+
def test_unsafe(self):
self.collection = lesana.Collection('tests/data/simple')
self.collection.safe = False