Pep8.
This commit is contained in:
parent
dcb2d3e7d4
commit
943065c15f
@ -15,9 +15,10 @@ from plone.app.discussion.testing import \
|
||||
|
||||
|
||||
optionflags = (
|
||||
doctest.ELLIPSIS | \
|
||||
doctest.NORMALIZE_WHITESPACE | \
|
||||
doctest.REPORT_ONLY_FIRST_FAILURE)
|
||||
doctest.ELLIPSIS |
|
||||
doctest.NORMALIZE_WHITESPACE |
|
||||
doctest.REPORT_ONLY_FIRST_FAILURE
|
||||
)
|
||||
normal_testfiles = [
|
||||
'functional_test_comments.txt',
|
||||
'functional_test_comment_review_workflow.txt',
|
||||
|
@ -40,9 +40,11 @@ class ConversationIndexersTest(unittest.TestCase):
|
||||
self.portal = self.layer['portal']
|
||||
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
||||
|
||||
self.portal.invokeFactory(id='doc1',
|
||||
self.portal.invokeFactory(
|
||||
id='doc1',
|
||||
title='Document 1',
|
||||
type_name='Document')
|
||||
type_name='Document'
|
||||
)
|
||||
|
||||
# Create a conversation.
|
||||
conversation = IConversation(self.portal.doc1)
|
||||
@ -74,8 +76,10 @@ class ConversationIndexersTest(unittest.TestCase):
|
||||
self.conversation = conversation
|
||||
|
||||
def test_conversation_total_comments(self):
|
||||
self.assertTrue(isinstance(catalog.total_comments,
|
||||
DelegatingIndexerFactory))
|
||||
self.assertTrue(isinstance(
|
||||
catalog.total_comments,
|
||||
DelegatingIndexerFactory
|
||||
))
|
||||
self.assertEqual(catalog.total_comments(self.portal.doc1)(), 3)
|
||||
del self.conversation[self.new_id1]
|
||||
self.assertEqual(catalog.total_comments(self.portal.doc1)(), 2)
|
||||
@ -84,13 +88,19 @@ class ConversationIndexersTest(unittest.TestCase):
|
||||
self.assertEqual(catalog.total_comments(self.portal.doc1)(), 0)
|
||||
|
||||
def test_conversation_last_comment_date(self):
|
||||
self.assertTrue(isinstance(catalog.last_comment_date,
|
||||
DelegatingIndexerFactory))
|
||||
self.assertEqual(catalog.last_comment_date(self.portal.doc1)(),
|
||||
datetime(2009, 4, 12, 11, 12, 12))
|
||||
self.assertTrue(isinstance(
|
||||
catalog.last_comment_date,
|
||||
DelegatingIndexerFactory
|
||||
))
|
||||
self.assertEqual(
|
||||
catalog.last_comment_date(self.portal.doc1)(),
|
||||
datetime(2009, 4, 12, 11, 12, 12)
|
||||
)
|
||||
del self.conversation[self.new_id3]
|
||||
self.assertEqual(catalog.last_comment_date(self.portal.doc1)(),
|
||||
datetime(2007, 12, 13, 4, 18, 12))
|
||||
self.assertEqual(
|
||||
catalog.last_comment_date(self.portal.doc1)(),
|
||||
datetime(2007, 12, 13, 4, 18, 12)
|
||||
)
|
||||
del self.conversation[self.new_id2]
|
||||
del self.conversation[self.new_id1]
|
||||
self.assertEqual(catalog.last_comment_date(self.portal.doc1)(), None)
|
||||
@ -111,9 +121,11 @@ class CommentIndexersTest(unittest.TestCase):
|
||||
self.portal = self.layer['portal']
|
||||
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
||||
|
||||
self.portal.invokeFactory(id='doc1',
|
||||
self.portal.invokeFactory(
|
||||
id='doc1',
|
||||
title='Document 1',
|
||||
type_name='Document')
|
||||
type_name='Document'
|
||||
)
|
||||
|
||||
# Create a conversation. In this case we doesn't assign it to an
|
||||
# object, as we just want to check the Conversation object API.
|
||||
@ -138,8 +150,10 @@ class CommentIndexersTest(unittest.TestCase):
|
||||
self.assertTrue(isinstance(catalog.title, DelegatingIndexerFactory))
|
||||
|
||||
def test_description(self):
|
||||
self.assertEqual(catalog.description(self.comment)(),
|
||||
'Lorem ipsum dolor sit amet.')
|
||||
self.assertEqual(
|
||||
catalog.description(self.comment)(),
|
||||
'Lorem ipsum dolor sit amet.'
|
||||
)
|
||||
self.assertTrue(
|
||||
isinstance(catalog.description, DelegatingIndexerFactory))
|
||||
|
||||
@ -151,24 +165,36 @@ class CommentIndexersTest(unittest.TestCase):
|
||||
comment_long.text = LONG_TEXT
|
||||
|
||||
self.conversation.addComment(comment_long)
|
||||
self.assertEqual(catalog.description(comment_long)(),
|
||||
LONG_TEXT_CUT.replace("\n", " "))
|
||||
self.assertEqual(
|
||||
catalog.description(comment_long)(),
|
||||
LONG_TEXT_CUT.replace("\n", " ")
|
||||
)
|
||||
|
||||
def test_dates(self):
|
||||
# Test if created, modified, effective etc. are set correctly
|
||||
self.assertEqual(catalog.created(self.comment)(),
|
||||
DateTime(2006, 9, 17, 14, 18, 12, 'GMT'))
|
||||
self.assertEqual(catalog.effective(self.comment)(),
|
||||
DateTime(2006, 9, 17, 14, 18, 12, 'GMT'))
|
||||
self.assertEqual(catalog.modified(self.comment)(),
|
||||
DateTime(2008, 3, 12, 7, 32, 52, 'GMT'))
|
||||
self.assertEqual(
|
||||
catalog.created(self.comment)(),
|
||||
DateTime(2006, 9, 17, 14, 18, 12, 'GMT')
|
||||
)
|
||||
self.assertEqual(
|
||||
catalog.effective(self.comment)(),
|
||||
DateTime(2006, 9, 17, 14, 18, 12, 'GMT')
|
||||
)
|
||||
self.assertEqual(
|
||||
catalog.modified(self.comment)(),
|
||||
DateTime(2008, 3, 12, 7, 32, 52, 'GMT')
|
||||
)
|
||||
|
||||
def test_searchable_text(self):
|
||||
# Test if searchable text is a concatenation of title and comment text
|
||||
self.assertEqual(catalog.searchable_text(self.comment)(),
|
||||
('Lorem ipsum dolor sit amet.'))
|
||||
self.assertTrue(isinstance(catalog.searchable_text,
|
||||
DelegatingIndexerFactory))
|
||||
self.assertEqual(
|
||||
catalog.searchable_text(self.comment)(),
|
||||
('Lorem ipsum dolor sit amet.')
|
||||
)
|
||||
self.assertTrue(isinstance(
|
||||
catalog.searchable_text,
|
||||
DelegatingIndexerFactory
|
||||
))
|
||||
|
||||
def test_creator(self):
|
||||
self.assertEqual(catalog.creator(self.comment)(), ('jim'))
|
||||
|
Loading…
Reference in New Issue
Block a user