diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2018-12-16 19:14:34 +0100 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2018-12-16 19:14:34 +0100 |
commit | e1842f4a9c6e06b1163ef1ae0d8c1b68c434a0a9 (patch) | |
tree | 7aeb886c4bf389f2465145eac71cd7fd5f00e235 /tests/test_collection.py | |
parent | e7279a50431bc86286acd1f167b3c1e364a9f33e (diff) |
Allow to identify entries with just the beginning of the uid.
Diffstat (limited to 'tests/test_collection.py')
-rw-r--r-- | tests/test_collection.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_collection.py b/tests/test_collection.py index 2b1864a..cc28a27 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -116,6 +116,23 @@ class testCollection(unittest.TestCase): ) self.assertEqual(entry.uid, '11189ee47ddf4796b718a483b379f976') + def test_entry_from_short_uid(self): + self.collection = lesana.Collection('tests/data/simple') + entries = self.collection.entries_from_short_uid( + '11189ee4' + ) + self.assertEqual(len(entries), 1) + self.assertEqual(entries[0].uid, '11189ee47ddf4796b718a483b379f976') + entries = self.collection.entries_from_short_uid( + '11189ee47ddf4796b718a483b379f976' + ) + self.assertEqual(len(entries), 1) + self.assertEqual(entries[0].uid, '11189ee47ddf4796b718a483b379f976') + entries = self.collection.entries_from_short_uid( + '12345678' + ) + self.assertEqual(len(entries), 0) + def test_index_missing_file(self): self.collection = lesana.Collection('tests/data/simple') with self.assertLogs(level=logging.WARNING) as cm: |