Merge branch 'master' into delete-own-comments

Conflicts:
	CHANGES.rst
This commit is contained in:
Timo Stollenwerk
2015-01-29 21:14:05 +01:00
20 changed files with 355 additions and 237 deletions
@@ -406,7 +406,7 @@ Submitting the form runs into a testbrowser notFoundException.
We'll just catch that and check the result later.
>>> try:
... form.submit()
... form.submit()
... except:
... pass
@@ -7,11 +7,13 @@ from Acquisition import aq_base
from zope.component import createObject
from zope.component import getSiteManager
from zope.component import queryUtility
from zope.component import getUtility
from plone.app.testing import TEST_USER_ID, setRoles
from Products.MailHost.interfaces import IMailHost
from Products.CMFPlone.tests.utils import MockMailHost
from Products.CMFPlone.interfaces import IMailSchema
from plone.registry.interfaces import IRegistry
@@ -34,7 +36,9 @@ class TestUserNotificationUnit(unittest.TestCase):
sm.unregisterUtility(provided=IMailHost)
sm.registerUtility(mailhost, provided=IMailHost)
# We need to fake a valid mail setup
self.portal.email_from_address = "portal@plone.test"
registry = getUtility(IRegistry)
mail_settings = registry.forInterface(IMailSchema, prefix='plone')
mail_settings.email_from_address = "portal@plone.test"
self.mailhost = self.portal.MailHost
# Enable user notification setting
registry = queryUtility(IRegistry)
@@ -122,7 +126,9 @@ class TestUserNotificationUnit(unittest.TestCase):
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
# the moderator.
self.portal.email_from_address = None
registry = getUtility(IRegistry)
mail_settings = registry.forInterface(IMailSchema, prefix='plone')
mail_settings.email_from_address = None
comment = createObject('plone.Comment')
comment.text = 'Comment text'
comment.user_notification = True
@@ -132,7 +138,6 @@ class TestUserNotificationUnit(unittest.TestCase):
comment.text = 'Comment text'
self.conversation.addComment(comment)
self.assertEqual(len(self.mailhost.messages), 0)
def test_notify_only_once(self):
@@ -172,7 +177,9 @@ class TestModeratorNotificationUnit(unittest.TestCase):
sm.unregisterUtility(provided=IMailHost)
sm.registerUtility(mailhost, provided=IMailHost)
# We need to fake a valid mail setup
self.portal.email_from_address = "portal@plone.test"
registry = getUtility(IRegistry)
mail_settings = registry.forInterface(IMailSchema, prefix='plone')
mail_settings.email_from_address = "portal@plone.test"
self.mailhost = self.portal.MailHost
# Enable comment moderation
self.portal.portal_types['Document'].allow_discussion = True
@@ -255,7 +262,9 @@ class TestModeratorNotificationUnit(unittest.TestCase):
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
# moderator.
self.portal.email_from_address = None
registry = getUtility(IRegistry)
mail_settings = registry.forInterface(IMailSchema, prefix='plone')
mail_settings.email_from_address = None
comment = createObject('plone.Comment')
comment.text = 'Comment text'