One argument per line

This commit is contained in:
Gil Forcada 2015-05-03 08:27:03 +02:00
parent 2baafcbfd8
commit 411f36e708
2 changed files with 35 additions and 12 deletions

View File

@ -245,7 +245,11 @@ class TestCommentForm(unittest.TestCase):
) )
# try to delete last comment without "Delete comments" permission # try to delete last comment without "Delete comments" permission
setRoles(self.portal, TEST_USER_ID, ['Member']) setRoles(self.portal, TEST_USER_ID, ['Member'])
self.assertRaises(Unauthorized, comment.restrictedTraverse, "@@moderate-delete-comment") self.assertRaises(
Unauthorized,
comment.restrictedTraverse,
"@@moderate-delete-comment"
)
deleteView() deleteView()
self.assertEqual(1, len([x for x in conversation.getComments()])) self.assertEqual(1, len([x for x in conversation.getComments()]))
# try to delete last comment with "Delete comments" permission # try to delete last comment with "Delete comments" permission
@ -300,7 +304,11 @@ class TestCommentForm(unittest.TestCase):
# try to delete last comment with johndoe # try to delete last comment with johndoe
setRoles(self.portal, 'johndoe', ['Member']) setRoles(self.portal, 'johndoe', ['Member'])
login(self.portal, 'johndoe') login(self.portal, 'johndoe')
self.assertRaises(Unauthorized, comment.restrictedTraverse, "@@delete-own-comment") self.assertRaises(
Unauthorized,
comment.restrictedTraverse,
"@@delete-own-comment"
)
self.assertEqual(1, len([x for x in conversation.getComments()])) self.assertEqual(1, len([x for x in conversation.getComments()]))
# try to delete last comment with the same user that created it # try to delete last comment with the same user that created it
login(self.portal, TEST_USER_NAME) login(self.portal, TEST_USER_NAME)

View File

@ -107,26 +107,41 @@ class ReplyContentRulesTest(unittest.TestCase):
new_re_id = replies.addComment(re_comment) new_re_id = replies.addComment(re_comment)
def testReplyIdStringSubstitution(self): def testReplyIdStringSubstitution(self):
reply_id = getAdapter(self.document, IStringSubstitution, reply_id = getAdapter(
name=u"comment_id") self.document,
IStringSubstitution,
name=u"comment_id"
)
self.assertIsInstance(reply_id(), long) self.assertIsInstance(reply_id(), long)
def testReplyTextStringSubstitution(self): def testReplyTextStringSubstitution(self):
reply_text = getAdapter(self.document, IStringSubstitution, reply_text = getAdapter(
name=u"comment_text") self.document,
IStringSubstitution,
name=u"comment_text"
)
self.assertEqual(reply_text(), u"This is a reply") self.assertEqual(reply_text(), u"This is a reply")
def testReplyUserIdStringSubstitution(self): def testReplyUserIdStringSubstitution(self):
reply_user_id = getAdapter(self.document, IStringSubstitution, reply_user_id = getAdapter(
name=u"comment_user_id") self.document,
IStringSubstitution,
name=u"comment_user_id"
)
self.assertEqual(reply_user_id(), u"julia") self.assertEqual(reply_user_id(), u"julia")
def testReplyUserFullNameStringSubstitution(self): def testReplyUserFullNameStringSubstitution(self):
reply_user_fullname = getAdapter(self.document, IStringSubstitution, reply_user_fullname = getAdapter(
name=u"comment_user_fullname") self.document,
IStringSubstitution,
name=u"comment_user_fullname"
)
self.assertEqual(reply_user_fullname(), u"Juliana") self.assertEqual(reply_user_fullname(), u"Juliana")
def testReplyUserEmailStringSubstitution(self): def testReplyUserEmailStringSubstitution(self):
reply_user_email = getAdapter(self.document, IStringSubstitution, reply_user_email = getAdapter(
name=u"comment_user_email") self.document,
IStringSubstitution,
name=u"comment_user_email"
)
self.assertEqual(reply_user_email(), u"julia@example.com") self.assertEqual(reply_user_email(), u"julia@example.com")