summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2018-12-16 19:14:34 +0100
committerElena ``of Valhalla'' Grandi <valhalla@trueelena.org>2018-12-16 19:14:34 +0100
commite1842f4a9c6e06b1163ef1ae0d8c1b68c434a0a9 (patch)
tree7aeb886c4bf389f2465145eac71cd7fd5f00e235 /tests
parente7279a50431bc86286acd1f167b3c1e364a9f33e (diff)
Allow to identify entries with just the beginning of the uid.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_collection.py17
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: