Some more tests for moderation bulk actions.
svn path=/plone.app.discussion/trunk/; revision=39945
This commit is contained in:
parent
742412a7d8
commit
e8a4caa5db
@ -23,12 +23,12 @@ from plone.app.discussion.interfaces import IComment
|
|||||||
#
|
#
|
||||||
|
|
||||||
def _getContext(self): # pragma: no cover
|
def _getContext(self): # pragma: no cover
|
||||||
self = self.aq_parent
|
self = self.aq_parent # pragma: no cover
|
||||||
while getattr(self, '_is_wrapperish', None):
|
while getattr(self, '_is_wrapperish', None): # pragma: no cover
|
||||||
self = self.aq_parent
|
self = self.aq_parent # pragma: no cover
|
||||||
return self
|
return self # pragma: no cover
|
||||||
|
|
||||||
ZopeTwoPageTemplateFile._getContext = _getContext
|
ZopeTwoPageTemplateFile._getContext = _getContext # pragma: no cover
|
||||||
# End ugly hack.
|
# End ugly hack.
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,11 +143,27 @@ class ModerationBulkActionsViewTest(PloneTestCase):
|
|||||||
|
|
||||||
self.conversation = conversation
|
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):
|
def test_retract(self):
|
||||||
self.request = self.app.REQUEST
|
self.request = self.app.REQUEST
|
||||||
self.context = self.portal
|
self.context = self.portal
|
||||||
self.request.set('form.select.BulkAction', 'retract')
|
self.request.set('form.select.BulkAction', 'retract')
|
||||||
view = BulkActionsView(self.context, self.request)
|
view = BulkActionsView(self.context, self.request)
|
||||||
|
view()
|
||||||
|
|
||||||
self.assertRaises(NotImplementedError,
|
self.assertRaises(NotImplementedError,
|
||||||
view.retract)
|
view.retract)
|
||||||
@ -168,6 +184,7 @@ class ModerationBulkActionsViewTest(PloneTestCase):
|
|||||||
if workflow_status == 'published':
|
if workflow_status == 'published':
|
||||||
published_comments += 1
|
published_comments += 1
|
||||||
|
|
||||||
|
# Make sure the comment has been published
|
||||||
self.assertEquals(published_comments, 1)
|
self.assertEquals(published_comments, 1)
|
||||||
|
|
||||||
def test_mark_as_spam(self):
|
def test_mark_as_spam(self):
|
||||||
@ -175,6 +192,7 @@ class ModerationBulkActionsViewTest(PloneTestCase):
|
|||||||
self.context = self.portal
|
self.context = self.portal
|
||||||
self.request.set('form.select.BulkAction', 'mark_as_spam')
|
self.request.set('form.select.BulkAction', 'mark_as_spam')
|
||||||
view = BulkActionsView(self.context, self.request)
|
view = BulkActionsView(self.context, self.request)
|
||||||
|
view()
|
||||||
|
|
||||||
self.assertRaises(NotImplementedError,
|
self.assertRaises(NotImplementedError,
|
||||||
view.mark_as_spam)
|
view.mark_as_spam)
|
||||||
|
Loading…
Reference in New Issue
Block a user