Redirect to the comment itself when notifying a user about a new comment.
svn path=/plone.app.discussion/trunk/; revision=49030
This commit is contained in:
parent
1c2d5651b9
commit
49504c1ddd
@ -253,7 +253,7 @@ def notify_user(obj, event):
|
|||||||
message = translate(Message(
|
message = translate(Message(
|
||||||
MAIL_NOTIFICATION_MESSAGE,
|
MAIL_NOTIFICATION_MESSAGE,
|
||||||
mapping={'title': safe_unicode(content_object.title),
|
mapping={'title': safe_unicode(content_object.title),
|
||||||
'link': content_object.absolute_url()}),
|
'link': obj.absolute_url()}),
|
||||||
context=obj.REQUEST)
|
context=obj.REQUEST)
|
||||||
for email in emails:
|
for email in emails:
|
||||||
# Send email
|
# Send email
|
||||||
@ -284,7 +284,6 @@ def notify_moderator(obj, event):
|
|||||||
control panel and the comment_review_workflow enabled for the comment
|
control panel and the comment_review_workflow enabled for the comment
|
||||||
content type.
|
content type.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Check if moderator notification is enabled
|
# Check if moderator notification is enabled
|
||||||
registry = queryUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
settings = registry.forInterface(IDiscussionSettings, check=False)
|
settings = registry.forInterface(IDiscussionSettings, check=False)
|
||||||
@ -314,7 +313,7 @@ def notify_moderator(obj, event):
|
|||||||
subject = translate(_(u"A comment has been posted."), context=obj.REQUEST)
|
subject = translate(_(u"A comment has been posted."), context=obj.REQUEST)
|
||||||
message = translate(Message(MAIL_NOTIFICATION_MESSAGE,
|
message = translate(Message(MAIL_NOTIFICATION_MESSAGE,
|
||||||
mapping={'title': safe_unicode(content_object.title),
|
mapping={'title': safe_unicode(content_object.title),
|
||||||
'link': content_object.absolute_url()}),
|
'link': obj.absolute_url()}),
|
||||||
context=obj.REQUEST)
|
context=obj.REQUEST)
|
||||||
|
|
||||||
# Send email
|
# Send email
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# coding=utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import unittest2 as unittest
|
import unittest2 as unittest
|
||||||
|
|
||||||
@ -17,14 +17,14 @@ from Products.CMFPlone.tests.utils import MockMailHost
|
|||||||
from plone.registry.interfaces import IRegistry
|
from plone.registry.interfaces import IRegistry
|
||||||
|
|
||||||
from plone.app.discussion.interfaces import IConversation
|
from plone.app.discussion.interfaces import IConversation
|
||||||
from plone.app.discussion.testing import PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
from plone.app.discussion.testing import\
|
||||||
|
PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
|
|
||||||
|
|
||||||
class TestUserNotificationUnit(unittest.TestCase):
|
class TestUserNotificationUnit(unittest.TestCase):
|
||||||
|
|
||||||
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.portal = self.layer['portal']
|
self.portal = self.layer['portal']
|
||||||
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
||||||
@ -34,16 +34,13 @@ class TestUserNotificationUnit(unittest.TestCase):
|
|||||||
sm = getSiteManager(context=self.portal)
|
sm = getSiteManager(context=self.portal)
|
||||||
sm.unregisterUtility(provided=IMailHost)
|
sm.unregisterUtility(provided=IMailHost)
|
||||||
sm.registerUtility(mailhost, provided=IMailHost)
|
sm.registerUtility(mailhost, provided=IMailHost)
|
||||||
|
|
||||||
# We need to fake a valid mail setup
|
# We need to fake a valid mail setup
|
||||||
self.portal.email_from_address = "portal@plone.test"
|
self.portal.email_from_address = "portal@plone.test"
|
||||||
self.mailhost = self.portal.MailHost
|
self.mailhost = self.portal.MailHost
|
||||||
|
|
||||||
# Enable user notification setting
|
# Enable user notification setting
|
||||||
registry = queryUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
registry['plone.app.discussion.interfaces.IDiscussionSettings' +
|
registry['plone.app.discussion.interfaces.IDiscussionSettings' +
|
||||||
'.user_notification_enabled'] = True
|
'.user_notification_enabled'] = True
|
||||||
|
|
||||||
# Create test content
|
# Create test content
|
||||||
self.portal.invokeFactory('Document', 'doc1')
|
self.portal.invokeFactory('Document', 'doc1')
|
||||||
self.portal_discussion = self.portal.portal_discussion
|
self.portal_discussion = self.portal.portal_discussion
|
||||||
@ -51,14 +48,14 @@ class TestUserNotificationUnit(unittest.TestCase):
|
|||||||
# The missing u in front of a string is therefor not missing
|
# The missing u in front of a string is therefor not missing
|
||||||
self.portal.doc1.title = 'Kölle Alaaf' # What is "Fasching"?
|
self.portal.doc1.title = 'Kölle Alaaf' # What is "Fasching"?
|
||||||
self.conversation = IConversation(self.portal.doc1)
|
self.conversation = IConversation(self.portal.doc1)
|
||||||
|
|
||||||
def beforeTearDown(self):
|
def beforeTearDown(self):
|
||||||
self.portal.MailHost = self.portal._original_MailHost
|
self.portal.MailHost = self.portal._original_MailHost
|
||||||
sm = getSiteManager(context=self.portal)
|
sm = getSiteManager(context=self.portal)
|
||||||
sm.unregisterUtility(provided=IMailHost)
|
sm.unregisterUtility(provided=IMailHost)
|
||||||
sm.registerUtility(aq_base(self.portal._original_MailHost),
|
sm.registerUtility(aq_base(self.portal._original_MailHost),
|
||||||
provided=IMailHost)
|
provided=IMailHost)
|
||||||
|
|
||||||
def test_notify_user(self):
|
def test_notify_user(self):
|
||||||
# Add a comment with user notification enabled. Add another comment
|
# Add a comment with user notification enabled. Add another comment
|
||||||
# and make sure an email is send to the user of the first comment.
|
# and make sure an email is send to the user of the first comment.
|
||||||
@ -67,139 +64,122 @@ class TestUserNotificationUnit(unittest.TestCase):
|
|||||||
comment.user_notification = True
|
comment.user_notification = True
|
||||||
comment.author_email = "john@plone.test"
|
comment.author_email = "john@plone.test"
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
self.conversation.addComment(comment)
|
|
||||||
|
comment_id = self.conversation.addComment(comment)
|
||||||
|
|
||||||
self.assertEqual(len(self.mailhost.messages), 1)
|
self.assertEqual(len(self.mailhost.messages), 1)
|
||||||
self.assertTrue(self.mailhost.messages[0])
|
self.assertTrue(self.mailhost.messages[0])
|
||||||
msg = str(self.mailhost.messages[0])
|
msg = str(self.mailhost.messages[0])
|
||||||
self.assertTrue('To: john@plone.test' in msg)
|
self.assertTrue('To: john@plone.test' in msg)
|
||||||
self.assertTrue('From: portal@plone.test' in msg)
|
self.assertTrue('From: portal@plone.test' in msg)
|
||||||
|
|
||||||
# We expect the headers to be properly header encoded (7-bit):
|
# We expect the headers to be properly header encoded (7-bit):
|
||||||
#>>> 'Subject: =?utf-8?q?Some_t=C3=A4st_subject=2E?=' in msg
|
self.assertTrue(
|
||||||
#True
|
'Subject: =?utf-8?q?A_comment_has_been_posted=2E?=\n'
|
||||||
# # The output should be encoded in a reasonable manner
|
in msg)
|
||||||
|
# The output should be encoded in a reasonable manner
|
||||||
# (in this case quoted-printable):
|
# (in this case quoted-printable):
|
||||||
#>>> msg
|
self.assertTrue(
|
||||||
#'...Another t=C3=A4st message...You are receiving this mail \
|
"A comment on \'K=C3=B6lle Alaaf\' has been posted here:"
|
||||||
#because T=C3=A4st user\ntest@plone.test...is sending feedback \
|
in msg)
|
||||||
#about the site you administer at...
|
self.assertTrue(
|
||||||
|
"http://nohost/plone/d=\noc1/++conversation++default/%s"
|
||||||
|
% comment_id
|
||||||
|
in msg)
|
||||||
|
|
||||||
def test_do_not_notify_user_when_notification_is_disabled(self):
|
def test_do_not_notify_user_when_notification_is_disabled(self):
|
||||||
# Disable user notification and make sure no email is send to the user.
|
|
||||||
registry = queryUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
registry['plone.app.discussion.interfaces.IDiscussionSettings.' +
|
registry['plone.app.discussion.interfaces.IDiscussionSettings.' +
|
||||||
'user_notification_enabled'] = False
|
'user_notification_enabled'] = False
|
||||||
|
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
comment.user_notification = True
|
comment.user_notification = True
|
||||||
comment.author_email = "john@plone.test"
|
comment.author_email = "john@plone.test"
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
|
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
self.assertEqual(len(self.mailhost.messages), 0)
|
self.assertEqual(len(self.mailhost.messages), 0)
|
||||||
|
|
||||||
def test_do_not_notify_user_when_email_address_is_given(self):
|
def test_do_not_notify_user_when_email_address_is_given(self):
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
comment.user_notification = True
|
comment.user_notification = True
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
|
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
self.assertEqual(len(self.mailhost.messages), 0)
|
self.assertEqual(len(self.mailhost.messages), 0)
|
||||||
|
|
||||||
def test_do_not_notify_user_when_no_sender_is_available(self):
|
def test_do_not_notify_user_when_no_sender_is_available(self):
|
||||||
# Set sender mail address to none and make sure no email is send to
|
# Set sender mail address to none and make sure no email is send to
|
||||||
# the moderator.
|
# the moderator.
|
||||||
self.portal.email_from_address = None
|
self.portal.email_from_address = None
|
||||||
|
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
comment.user_notification = True
|
comment.user_notification = True
|
||||||
comment.author_email = "john@plone.test"
|
comment.author_email = "john@plone.test"
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
|
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
self.assertEqual(len(self.mailhost.messages), 0)
|
self.assertEqual(len(self.mailhost.messages), 0)
|
||||||
|
|
||||||
def test_notify_only_once(self):
|
def test_notify_only_once(self):
|
||||||
# When a user has added two comments in a conversation and has
|
# When a user has added two comments in a conversation and has
|
||||||
# both times requested email notification, do not send him two
|
# both times requested email notification, do not send him two
|
||||||
# emails when another comment has been added.
|
# emails when another comment has been added.
|
||||||
|
|
||||||
# Comment 1
|
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
comment.user_notification = True
|
comment.user_notification = True
|
||||||
comment.author_email = "john@plone.test"
|
comment.author_email = "john@plone.test"
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
# Comment 2
|
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
comment.user_notification = True
|
comment.user_notification = True
|
||||||
comment.author_email = "john@plone.test"
|
comment.author_email = "john@plone.test"
|
||||||
|
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
# Note that we might want to get rid of this message, as the
|
# Note that we might want to get rid of this message, as the
|
||||||
# new comment is added by the same user.
|
# new comment is added by the same user.
|
||||||
self.assertEqual(len(self.mailhost.messages), 1)
|
self.assertEqual(len(self.mailhost.messages), 1)
|
||||||
self.mailhost.reset()
|
self.mailhost.reset()
|
||||||
self.assertEqual(len(self.mailhost.messages), 0)
|
self.assertEqual(len(self.mailhost.messages), 0)
|
||||||
|
|
||||||
# Comment 3
|
|
||||||
comment = createObject('plone.Comment')
|
|
||||||
comment.text = 'Comment text'
|
|
||||||
self.conversation.addComment(comment)
|
|
||||||
self.assertEqual(len(self.mailhost.messages), 1)
|
|
||||||
self.assertTrue(self.mailhost.messages[0])
|
|
||||||
msg = str(self.mailhost.messages[0])
|
|
||||||
self.assertTrue('To: john@plone.test' in msg)
|
|
||||||
self.assertTrue('From: portal@plone.test' in msg)
|
|
||||||
|
|
||||||
|
|
||||||
class TestModeratorNotificationUnit(unittest.TestCase):
|
class TestModeratorNotificationUnit(unittest.TestCase):
|
||||||
|
|
||||||
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
layer = PLONE_APP_DISCUSSION_INTEGRATION_TESTING
|
||||||
|
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.portal = self.layer['portal']
|
self.portal = self.layer['portal']
|
||||||
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
||||||
|
|
||||||
# Set up a mock mailhost
|
# Set up a mock mailhost
|
||||||
self.portal._original_MailHost = self.portal.MailHost
|
self.portal._original_MailHost = self.portal.MailHost
|
||||||
self.portal.MailHost = mailhost = MockMailHost('MailHost')
|
self.portal.MailHost = mailhost = MockMailHost('MailHost')
|
||||||
sm = getSiteManager(context=self.portal)
|
sm = getSiteManager(context=self.portal)
|
||||||
sm.unregisterUtility(provided=IMailHost)
|
sm.unregisterUtility(provided=IMailHost)
|
||||||
sm.registerUtility(mailhost, provided=IMailHost)
|
sm.registerUtility(mailhost, provided=IMailHost)
|
||||||
|
|
||||||
# We need to fake a valid mail setup
|
# We need to fake a valid mail setup
|
||||||
self.portal.email_from_address = "portal@plone.test"
|
self.portal.email_from_address = "portal@plone.test"
|
||||||
self.mailhost = self.portal.MailHost
|
self.mailhost = self.portal.MailHost
|
||||||
|
|
||||||
# Enable comment moderation
|
# Enable comment moderation
|
||||||
self.portal.portal_types['Document'].allow_discussion = True
|
self.portal.portal_types['Document'].allow_discussion = True
|
||||||
self.portal.portal_workflow.setChainForPortalTypes(
|
self.portal.portal_workflow.setChainForPortalTypes(
|
||||||
('Discussion Item',),
|
('Discussion Item',),
|
||||||
('comment_review_workflow',))
|
('comment_review_workflow',))
|
||||||
|
|
||||||
# Enable moderator notification setting
|
# Enable moderator notification setting
|
||||||
registry = queryUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
registry['plone.app.discussion.interfaces.IDiscussionSettings.' +
|
registry['plone.app.discussion.interfaces.IDiscussionSettings.' +
|
||||||
'moderator_notification_enabled'] = True
|
'moderator_notification_enabled'] = True
|
||||||
|
|
||||||
# Create test content
|
# Create test content
|
||||||
self.portal.invokeFactory('Document', 'doc1')
|
self.portal.invokeFactory('Document', 'doc1')
|
||||||
self.portal_discussion = self.portal.portal_discussion
|
self.portal_discussion = self.portal.portal_discussion
|
||||||
@ -207,46 +187,48 @@ class TestModeratorNotificationUnit(unittest.TestCase):
|
|||||||
# The missing u in front of a string is therefor not missing
|
# The missing u in front of a string is therefor not missing
|
||||||
self.portal.doc1.title = 'Kölle Alaaf' # What is "Fasching"?
|
self.portal.doc1.title = 'Kölle Alaaf' # What is "Fasching"?
|
||||||
self.conversation = IConversation(self.portal.doc1)
|
self.conversation = IConversation(self.portal.doc1)
|
||||||
|
|
||||||
def beforeTearDown(self):
|
def beforeTearDown(self):
|
||||||
self.portal.MailHost = self.portal._original_MailHost
|
self.portal.MailHost = self.portal._original_MailHost
|
||||||
sm = getSiteManager(context=self.portal)
|
sm = getSiteManager(context=self.portal)
|
||||||
sm.unregisterUtility(provided=IMailHost)
|
sm.unregisterUtility(provided=IMailHost)
|
||||||
sm.registerUtility(aq_base(self.portal._original_MailHost),
|
sm.registerUtility(aq_base(self.portal._original_MailHost),
|
||||||
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'
|
||||||
self.conversation.addComment(comment)
|
|
||||||
|
comment_id = self.conversation.addComment(comment)
|
||||||
|
|
||||||
self.assertEqual(len(self.mailhost.messages), 1)
|
self.assertEqual(len(self.mailhost.messages), 1)
|
||||||
self.assertTrue(self.mailhost.messages[0])
|
self.assertTrue(self.mailhost.messages[0])
|
||||||
msg = self.mailhost.messages[0]
|
msg = self.mailhost.messages[0]
|
||||||
|
|
||||||
self.assertTrue('To: portal@plone.test' in msg)
|
self.assertTrue('To: portal@plone.test' in msg)
|
||||||
self.assertTrue('From: portal@plone.test' in msg)
|
self.assertTrue('From: portal@plone.test' in msg)
|
||||||
|
# We expect the headers to be properly header encoded (7-bit):
|
||||||
#We expect the headers to be properly header encoded (7-bit):
|
self.assertTrue(
|
||||||
#>>> 'Subject: =?utf-8?q?Some_t=C3=A4st_subject=2E?=' in msg
|
'Subject: =?utf-8?q?A_comment_has_been_posted=2E?=\n'
|
||||||
#True
|
in msg)
|
||||||
|
# The output should be encoded in a reasonable manner
|
||||||
#The output should be encoded in a reasonable manner (in this case
|
# (in this case quoted-printable):
|
||||||
# quoted-printable):
|
self.assertTrue(
|
||||||
#>>> msg
|
"A comment on \'K=C3=B6lle Alaaf\' has been posted here:"
|
||||||
#'...Another t=C3=A4st message...You are receiving this mail because
|
in msg)
|
||||||
# T=C3=A4st user\ntest@plone.test...is sending feedback about the site
|
self.assertTrue(
|
||||||
# you administer at...
|
"http://nohost/plone/d=\noc1/++conversation++default/%s"
|
||||||
|
% comment_id
|
||||||
|
in msg)
|
||||||
|
|
||||||
def test_notify_moderator_specific_address(self):
|
def test_notify_moderator_specific_address(self):
|
||||||
# A moderator email address can be specified in the control panel.
|
# A moderator email address can be specified in the control panel.
|
||||||
registry = queryUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
registry['plone.app.discussion.interfaces.IDiscussionSettings' +
|
registry['plone.app.discussion.interfaces.IDiscussionSettings' +
|
||||||
'.moderator_email'] = 'test@example.com'
|
'.moderator_email'] = 'test@example.com'
|
||||||
|
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
|
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
self.assertEqual(len(self.mailhost.messages), 1)
|
self.assertEqual(len(self.mailhost.messages), 1)
|
||||||
@ -255,27 +237,29 @@ class TestModeratorNotificationUnit(unittest.TestCase):
|
|||||||
self.assertTrue('test@example.com' in msg.mto)
|
self.assertTrue('test@example.com' in msg.mto)
|
||||||
else:
|
else:
|
||||||
self.assertTrue('To: test@example.com' in msg)
|
self.assertTrue('To: test@example.com' in msg)
|
||||||
|
|
||||||
def test_do_not_notify_moderator_when_no_sender_is_available(self):
|
def test_do_not_notify_moderator_when_no_sender_is_available(self):
|
||||||
# Set sender mail address to nonw and make sure no email is send to the
|
# Set sender mail address to nonw and make sure no email is send to the
|
||||||
# moderator.
|
# moderator.
|
||||||
self.portal.email_from_address = None
|
self.portal.email_from_address = None
|
||||||
|
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
|
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
self.assertEqual(len(self.mailhost.messages), 0)
|
self.assertEqual(len(self.mailhost.messages), 0)
|
||||||
|
|
||||||
def test_do_not_notify_moderator_when_notification_is_disabled(self):
|
def test_do_not_notify_moderator_when_notification_is_disabled(self):
|
||||||
# Disable moderator notification setting and make sure no email is send
|
# Disable moderator notification setting and make sure no email is send
|
||||||
# to the moderator.
|
# to the moderator.
|
||||||
registry = queryUtility(IRegistry)
|
registry = queryUtility(IRegistry)
|
||||||
registry['plone.app.discussion.interfaces.IDiscussionSettings.' +
|
registry['plone.app.discussion.interfaces.IDiscussionSettings.' +
|
||||||
'moderator_notification_enabled'] = False
|
'moderator_notification_enabled'] = False
|
||||||
|
|
||||||
comment = createObject('plone.Comment')
|
comment = createObject('plone.Comment')
|
||||||
comment.text = 'Comment text'
|
comment.text = 'Comment text'
|
||||||
|
|
||||||
self.conversation.addComment(comment)
|
self.conversation.addComment(comment)
|
||||||
|
|
||||||
self.assertEqual(len(self.mailhost.messages), 0)
|
self.assertEqual(len(self.mailhost.messages), 0)
|
||||||
|
|
||||||
def test_suite():
|
def test_suite():
|
||||||
|
Loading…
Reference in New Issue
Block a user