Update tests
This commit is contained in:
parent
16123e268b
commit
42e5238622
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user