test_notifications moderator

This commit is contained in:
Katja Suess 2019-12-02 09:09:49 +01:00
parent 296d591856
commit 7b43d80486
1 changed files with 10 additions and 16 deletions

View File

@ -197,9 +197,10 @@ class TestModeratorNotificationUnit(unittest.TestCase):
provided=IMailHost) provided=IMailHost)
def test_notify_moderator(self): def test_notify_moderator(self):
# Add a comment and make sure an email is send to the moderator. """Add a comment and make sure an email is send to the moderator."""
comment = createObject('plone.Comment') comment = createObject('plone.Comment')
comment.text = 'Comment text' comment.text = 'Comment text'
comment.author_email = 'john@plone.test'
comment_id = self.conversation.addComment(comment) comment_id = self.conversation.addComment(comment)
@ -215,27 +216,20 @@ class TestModeratorNotificationUnit(unittest.TestCase):
# The output should be encoded in a reasonable manner # The output should be encoded in a reasonable manner
# (in this case quoted-printable): # (in this case quoted-printable):
self.assertTrue( self.assertTrue(
'A comment on "K=C3=B6lle Alaaf" has been posted here:' 'A comment on "K=C3=B6lle Alaaf" has been posted'
in msg) in msg
self.assertIn(
'http://nohost/plone/d=\noc1/view#{0}'.format(comment_id),
msg,
) )
self.assertIn( self.assertIn(
'Comment text', 'http://nohost/plone/doc1/view#{0}'.format(comment_id),
msg, msg
) )
text = 'Approve comment:\nhttp://nohost/plone/doc1/' \
'++conversation++default/{0}/@@moderat=\ne-publish-comment'
self.assertIn( self.assertIn(
text.format(comment_id), comment.author_email,
msg, msg
) )
text = 'Delete comment:\nhttp://nohost/plone/doc1/' \
'++conversation++default/{0}/@@moderat=\ne-delete-comment'
self.assertIn( self.assertIn(
text.format(comment_id), comment.text,
msg, msg
) )
def test_notify_moderator_specific_address(self): def test_notify_moderator_specific_address(self):