aboutsummaryrefslogtreecommitdiff
path: root/tests/test_collection.py
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2016-12-13 18:29:19 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2016-12-13 18:29:19 +0100
commit1c587b319a308a877608531961491f1dbb79317b (patch)
tree2722df12c41c9653dc426aa30c17c785d2489f2a /tests/test_collection.py
parent8ec0cae371a0b392b81bf34d5ee849c233ebbf65 (diff)
Indexing of entries
Diffstat (limited to 'tests/test_collection.py')
-rw-r--r--tests/test_collection.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_collection.py b/tests/test_collection.py
index be9a4e5..c54dc32 100644
--- a/tests/test_collection.py
+++ b/tests/test_collection.py
@@ -3,6 +3,8 @@ import os.path
import shutil
import unittest
+import ruamel.yaml
+
import lesana
@@ -44,3 +46,24 @@ class testCollectionLoading(unittest.TestCase):
self.collection = lesana.Collection('tests/data/simple')
self.collection.safe = False
self.collection.update_cache()
+
+
+class testEntries(unittest.TestCase):
+ def setUp(self):
+ self.collection = lesana.Collection('tests/data/simple')
+ self.basepath = 'tests/data/simple/items'
+
+ def test_simple(self):
+ fname = '085682ed-6792-499d-a3ab-9aebd683c011.yaml'
+ with open(os.path.join(self.basepath, fname)) as fp:
+ data = ruamel.yaml.load(fp)
+ entry = lesana.Entry(self.collection, data=data, fname=fname)
+ self.assertEqual(entry.idterm, 'Q'+data['uid'])
+ self.assertEqual(len(entry.indexed_fields), 3)
+ fname = '11189ee47ddf4796b718a483b379f976.yaml'
+ uid = '11189ee47ddf4796b718a483b379f976'
+ with open(os.path.join(self.basepath, fname)) as fp:
+ data = ruamel.yaml.load(fp)
+ entry = lesana.Entry(self.collection, data=data, fname=fname)
+ self.assertEqual(entry.idterm, 'Q'+uid)
+ self.assertEqual(len(entry.indexed_fields), 3)