diff options
Diffstat (limited to 'tests/test_collection.py')
-rw-r--r-- | tests/test_collection.py | 23 |
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) |