Some more tests for moderation bulk actions.

svn path=/plone.app.discussion/trunk/; revision=39945
This commit is contained in:
Timo Stollenwerk 2010-09-16 15:42:27 +00:00
parent 742412a7d8
commit e8a4caa5db
2 changed files with 24 additions and 6 deletions

View File

@ -23,12 +23,12 @@ from plone.app.discussion.interfaces import IComment
#
def _getContext(self): # pragma: no cover
self = self.aq_parent
while getattr(self, '_is_wrapperish', None):
self = self.aq_parent
return self
self = self.aq_parent # pragma: no cover
while getattr(self, '_is_wrapperish', None): # pragma: no cover
self = self.aq_parent # pragma: no cover
return self # pragma: no cover
ZopeTwoPageTemplateFile._getContext = _getContext
ZopeTwoPageTemplateFile._getContext = _getContext # pragma: no cover
# End ugly hack.

View File

@ -143,11 +143,27 @@ class ModerationBulkActionsViewTest(PloneTestCase):
self.conversation = conversation
def test_default_bulkaction(self):
self.request = self.app.REQUEST
self.context = self.portal
self.request.set('form.select.BulkAction', '-1')
view = BulkActionsView(self.context, self.request)
self.failIf(view())
def test_wrong_bulkaction(self):
self.request = self.app.REQUEST
self.context = self.portal
self.request.set('form.select.BulkAction', 'stupid')
view = BulkActionsView(self.context, self.request)
self.assertRaises(TypeError,
view)
def test_retract(self):
self.request = self.app.REQUEST
self.context = self.portal
self.request.set('form.select.BulkAction', 'retract')
view = BulkActionsView(self.context, self.request)
view()
self.assertRaises(NotImplementedError,
view.retract)
@ -168,6 +184,7 @@ class ModerationBulkActionsViewTest(PloneTestCase):
if workflow_status == 'published':
published_comments += 1
# Make sure the comment has been published
self.assertEquals(published_comments, 1)
def test_mark_as_spam(self):
@ -175,6 +192,7 @@ class ModerationBulkActionsViewTest(PloneTestCase):
self.context = self.portal
self.request.set('form.select.BulkAction', 'mark_as_spam')
view = BulkActionsView(self.context, self.request)
view()
self.assertRaises(NotImplementedError,
view.mark_as_spam)