From e1842f4a9c6e06b1163ef1ae0d8c1b68c434a0a9 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Sun, 16 Dec 2018 19:14:34 +0100 Subject: Allow to identify entries with just the beginning of the uid. --- tests/test_collection.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests') 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: -- cgit v1.2.3