Some more tests for moderation bulk actions.
svn path=/plone.app.discussion/trunk/; revision=39945
This commit is contained in:
parent
742412a7d8
commit
e8a4caa5db
@ -22,13 +22,13 @@ from plone.app.discussion.interfaces import IComment
|
||||
# Bug report: https://bugs.launchpad.net/zope2/+bug/176566
|
||||
#
|
||||
|
||||
def _getContext(self): # pragma: no cover
|
||||
self = self.aq_parent
|
||||
while getattr(self, '_is_wrapperish', None):
|
||||
self = self.aq_parent
|
||||
return self
|
||||
def _getContext(self): # pragma: no cover
|
||||
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.
|
||||
|
||||
|
||||
|
@ -142,12 +142,28 @@ class ModerationBulkActionsViewTest(PloneTestCase):
|
||||
'++conversation++default/%s' % new_id_3)
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user