Try reindexing comment and increasing delta (in case of slow test causing failure)

This commit is contained in:
Jon Pentland 2022-10-22 13:13:20 +02:00
parent 35b11a0120
commit 2df8ff4ea7

View File

@ -105,13 +105,15 @@ class ConversationTest(unittest.TestCase):
# Remove the timezone from the comment dates # Remove the timezone from the comment dates
comment.creation_date = datetime.utcnow() comment.creation_date = datetime.utcnow()
comment.modification_date = datetime.utcnow() comment.modification_date = datetime.utcnow()
comment.reindexObject()
# Check that the timezone naive date is converted to UTC # Check that the timezone naive date is converted to UTC
# See https://github.com/plone/plone.app.discussion/pull/204 # See https://github.com/plone/plone.app.discussion/pull/204
self.assertTrue( self.assertTrue(
conversation.last_comment_date conversation.last_comment_date
- datetime.utcnow().replace(tzinfo=timezone.utc) - datetime.utcnow().replace(tzinfo=timezone.utc)
< timedelta(seconds=1), < timedelta(seconds=10),
) )
self.assertTrue(comment.creation_date.tzinfo, timezone.utc) self.assertTrue(comment.creation_date.tzinfo, timezone.utc)
self.assertTrue(comment.modification_date.tzinfo, timezone.utc) self.assertTrue(comment.modification_date.tzinfo, timezone.utc)