From 42e52386228813594a1f3069e0278c1b90f3d932 Mon Sep 17 00:00:00 2001 From: Jon Pentland Date: Tue, 18 Oct 2022 15:17:17 +0100 Subject: [PATCH] Update tests --- plone/app/discussion/tests/test_catalog.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/plone/app/discussion/tests/test_catalog.py b/plone/app/discussion/tests/test_catalog.py index 395f6c2..03af8e9 100644 --- a/plone/app/discussion/tests/test_catalog.py +++ b/plone/app/discussion/tests/test_catalog.py @@ -1,6 +1,7 @@ """Test the plone.app.discussion catalog indexes """ from datetime import datetime +from datetime import timezone from plone.app.discussion.interfaces import IConversation from plone.app.discussion.testing import ( # noqa PLONE_APP_DISCUSSION_INTEGRATION_TESTING, @@ -67,8 +68,10 @@ class ConversationCatalogTest(unittest.TestCase): comment1.text = "Comment text" comment1.creator = "jim" comment1.author_username = "Jim" - comment1.creation_date = datetime(2006, 9, 17, 14, 18, 12) - comment1.modification_date = datetime(2006, 9, 17, 14, 18, 12) + comment1.creation_date = \ + datetime(2006, 9, 17, 14, 18, 12).astimezone(timezone.utc) + comment1.modification_date = \ + datetime(2006, 9, 17, 14, 18, 12).astimezone(timezone.utc) new_comment1_id = conversation.addComment(comment1) self.comment_id = new_comment1_id @@ -115,15 +118,17 @@ class ConversationCatalogTest(unittest.TestCase): self.assertTrue("last_comment_date" in self.doc1_brain) self.assertEqual( self.doc1_brain.last_comment_date, - datetime(2006, 9, 17, 14, 18, 12), + datetime(2006, 9, 17, 14, 18, 12).astimezone(timezone.utc), ) # Add another comment and check if last comment date is updated. comment2 = createObject("plone.Comment") comment2.title = "Comment 2" comment2.text = "Comment text" - comment2.creation_date = datetime(2009, 9, 17, 14, 18, 12) - comment2.modification_date = datetime(2009, 9, 17, 14, 18, 12) + comment2.creation_date = \ + datetime(2009, 9, 17, 14, 18, 12).astimezone(timezone.utc) + comment2.modification_date = \ + datetime(2009, 9, 17, 14, 18, 12).astimezone(timezone.utc) new_comment2_id = self.conversation.addComment(comment2) comment2 = self.portal.doc1.restrictedTraverse( @@ -141,7 +146,7 @@ class ConversationCatalogTest(unittest.TestCase): doc1_brain = brains[0] self.assertEqual( doc1_brain.last_comment_date, - datetime(2009, 9, 17, 14, 18, 12), + datetime(2009, 9, 17, 14, 18, 12).astimezone(timezone.utc), ) # Remove the comment again @@ -158,7 +163,7 @@ class ConversationCatalogTest(unittest.TestCase): doc1_brain = brains[0] self.assertEqual( doc1_brain.last_comment_date, - datetime(2006, 9, 17, 14, 18, 12), + datetime(2006, 9, 17, 14, 18, 12).astimezone(timezone.utc), ) # remove all comments