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

View File

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