From 836b4106aeef9acd30a4fd4dbca00c5d90e9aef7 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Wed, 10 Feb 2021 09:32:37 +0100 Subject: Add the option to autoincrement integer values --- tests/test_collection.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tests/test_collection.py') diff --git a/tests/test_collection.py b/tests/test_collection.py index 527acf9..84c535d 100644 --- a/tests/test_collection.py +++ b/tests/test_collection.py @@ -297,7 +297,7 @@ class testComplexCollection(unittest.TestCase): self.collection.settings['name'], "Fully featured lesana collection", ) - self.assertEqual(len(self.collection.settings['fields']), 13) + self.assertEqual(len(self.collection.settings['fields']), 14) self.assertIsNotNone(self.collection.stemmer) self.assertEqual(len(self.collection.indexed_fields), 8) @@ -424,21 +424,24 @@ class testComplexCollection(unittest.TestCase): eid = '5084bc6e94f24dc6976629282ef30419' entry = self.collection.entry_from_eid(eid) # we keep the old data, and check that the updated field is - # empty + # empty and the version field is 0 old_data = entry.data.copy() self.assertEqual(entry.data['updated'], None) + self.assertEqual(entry.data['version'], 0) entry.update() # after the update, fields that were not supposed to be updated # are equal to what they were before, while updated has been # changed to a datetime in this year (we don't check too deeply - # to avoid breaking tests too often with race conditions). + # to avoid breaking tests too often with race conditions) and + # version has grown to 2. for field in ('created', 'epoch'): self.assertEqual(old_data[field], entry.data[field]) now = datetime.datetime.now(datetime.timezone.utc) self.assertIsInstance(entry.data['updated'], datetime.datetime) self.assertEqual(entry.data['updated'].year, now.year) + self.assertEqual(entry.data['version'], 2) class testCollectionWithErrors(unittest.TestCase): -- cgit v1.2.3