Remove unnecessary and failing test.
svn path=/plone.app.discussion/trunk/; revision=46235
This commit is contained in:
parent
3968f6291e
commit
09a804aa88
@ -96,70 +96,6 @@ class TestCommentForm(PloneTestCase):
|
|||||||
self.assertEquals(len(errors), 0)
|
self.assertEquals(len(errors), 0)
|
||||||
self.failIf(commentForm.handleComment(commentForm, "foo"))
|
self.failIf(commentForm.handleComment(commentForm, "foo"))
|
||||||
|
|
||||||
def test_add_comment_with_reply_to_item_permission(self):
|
|
||||||
"""Add a comment with the 'reply to item' permission only.
|
|
||||||
"""
|
|
||||||
|
|
||||||
membership = self.portal.portal_membership
|
|
||||||
membership.addMember('user', 'secret', [], [])
|
|
||||||
membership.addMember('replier', 'secret', ['Reply to item',], [])
|
|
||||||
from Products.CMFCore.permissions import setDefaultRoles
|
|
||||||
from Products.CMFCore import permissions
|
|
||||||
permissions.setDefaultRoles("Reply to item", ('Authenticated',))
|
|
||||||
|
|
||||||
# Allow discussion
|
|
||||||
self.dtool.overrideDiscussionFor(self.portal.doc1, True)
|
|
||||||
self.viewlet = CommentsViewlet(self.context, self.request, None, None)
|
|
||||||
|
|
||||||
def make_request(form={}):
|
|
||||||
request = TestRequest()
|
|
||||||
request.form.update(form)
|
|
||||||
alsoProvides(request, IFormLayer)
|
|
||||||
alsoProvides(request, IAttributeAnnotatable)
|
|
||||||
return request
|
|
||||||
|
|
||||||
provideAdapter(adapts=(Interface, IBrowserRequest),
|
|
||||||
provides=Interface,
|
|
||||||
factory=CommentForm,
|
|
||||||
name=u"comment-form")
|
|
||||||
|
|
||||||
|
|
||||||
self.logout()
|
|
||||||
self.login('user')
|
|
||||||
|
|
||||||
request = make_request(form={'form.widgets.text': u'bar'})
|
|
||||||
commentForm = getMultiAdapter((self.context, request),
|
|
||||||
name=u"comment-form")
|
|
||||||
commentForm.update()
|
|
||||||
data, errors = commentForm.extractData() # pylint: disable-msg=W0612
|
|
||||||
|
|
||||||
# Sumitting a form as user without the 'reply to item' permission
|
|
||||||
# raises an unauthorized error.
|
|
||||||
self.assertEquals(len(errors), 0)
|
|
||||||
self.assertRaises(Unauthorized,
|
|
||||||
commentForm.handleComment,
|
|
||||||
commentForm,
|
|
||||||
"foo")
|
|
||||||
|
|
||||||
|
|
||||||
self.logout()
|
|
||||||
self.login('replier')
|
|
||||||
|
|
||||||
request = make_request(form={'form.widgets.text': u'bar'})
|
|
||||||
commentForm = getMultiAdapter((self.context, request),
|
|
||||||
name=u"comment-form")
|
|
||||||
commentForm.update()
|
|
||||||
data, errors = commentForm.extractData() # pylint: disable-msg=W0612
|
|
||||||
|
|
||||||
# Sumitting a form as user without the 'reply to item' permission
|
|
||||||
# raises an unauthorized error.
|
|
||||||
self.assertEquals(len(errors), 0)
|
|
||||||
|
|
||||||
#from AccessControl import getSecurityManager
|
|
||||||
#getSecurityManager().checkPermission('View', self.context)
|
|
||||||
#self.failIf(commentForm.handleComment(commentForm, "foo"))
|
|
||||||
|
|
||||||
|
|
||||||
def test_add_anonymous_comment(self):
|
def test_add_anonymous_comment(self):
|
||||||
"""Add a comment as anonymous.
|
"""Add a comment as anonymous.
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user