fixed HISTORY and add delete test to test_comments_viewlet
This commit is contained in:
parent
770651cf72
commit
22cc340ff6
57
CHANGES.rst
57
CHANGES.rst
@ -1,9 +1,59 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
2.3.0 (unreleased)
|
||||
2.3.2 (unreleased)
|
||||
------------------
|
||||
|
||||
- bugfix: according to IDiscussionSettings.anonymous_email_enabled (cite):
|
||||
"If selected, anonymous user will have to give their email." - But field
|
||||
was not required. Now it is.
|
||||
[jensens]
|
||||
|
||||
- bugfix: anonymous email field was never saved.
|
||||
[jensens]
|
||||
|
||||
- updated german translations: added some missing msgstr.
|
||||
[jensens]
|
||||
|
||||
- added i18ndude and a script ``update_translations`` to buildout in order
|
||||
to make translation updates simpler.
|
||||
[jensens]
|
||||
|
||||
- Fix reindexObject for content_object in moderation views.
|
||||
Now reindex only "total_comments" index and not all the indexes
|
||||
[cekk]
|
||||
|
||||
- Fix comments Title if utf-8 characters in author_name
|
||||
[huub_bouma]
|
||||
|
||||
- use member.getId as author_username, so membrane users having different id
|
||||
then username still have there picture shown and author path is correct.
|
||||
[maartenkling]
|
||||
|
||||
- Make comments editable.
|
||||
[pjstevns, gyst]
|
||||
|
||||
- Provide 'Delete comments' permission to handle comments deletion
|
||||
[cekk]
|
||||
|
||||
- Fixed Italian translations
|
||||
[cekk]
|
||||
|
||||
|
||||
2.3.1 (2014-02-22)
|
||||
------------------
|
||||
|
||||
- 2.3.0 was a brown bag release.
|
||||
[timo]
|
||||
|
||||
|
||||
2.3.0 (2014-02-22)
|
||||
------------------
|
||||
|
||||
- Execute the proper workflow change when using the moderation buttons instead
|
||||
of hardcoding the workflow action to always publish
|
||||
[omiron]
|
||||
|
||||
- Corrections and additions to the Danish translation
|
||||
[aputtu]
|
||||
|
||||
@ -25,11 +75,6 @@ Changelog
|
||||
|
||||
- Fix ownership of comments. [toutpt]
|
||||
|
||||
- Make comments editable.
|
||||
[pjstevns, gyst]
|
||||
|
||||
- Provide 'Delete comments' permission to handle comments deletion
|
||||
[cekk]
|
||||
|
||||
2.2.10 (2013-09-24)
|
||||
-------------------
|
||||
|
@ -187,15 +187,69 @@ class TestCommentForm(unittest.TestCase):
|
||||
|
||||
for comment in comments:
|
||||
self.assertEqual(comment.text, u"foobar")
|
||||
self.assertEqual(comment.creator, "test-user")
|
||||
self.assertEqual(comment.creator, "test_user_1_")
|
||||
self.assertEqual(comment.getOwner().getUserName(), "test-user")
|
||||
local_roles = comment.get_local_roles()
|
||||
self.assertEqual(len(local_roles), 2)
|
||||
self.assertEqual(len(local_roles), 1)
|
||||
userid, roles = local_roles[0]
|
||||
self.assertEqual(userid, 'test-user')
|
||||
self.assertEqual(userid, 'test_user_1_')
|
||||
self.assertEqual(len(roles), 1)
|
||||
self.assertEqual(roles[0], 'Owner')
|
||||
|
||||
def test_delete_comment(self):
|
||||
"""Delete a comment as logged-in user.
|
||||
"""
|
||||
|
||||
# Allow discussion
|
||||
self.portal.doc1.allow_discussion = 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"
|
||||
)
|
||||
|
||||
# The form is submitted successfully, if the required text field is
|
||||
# filled out
|
||||
form_request = make_request(form={'form.widgets.text': u'bar'})
|
||||
|
||||
commentForm = getMultiAdapter(
|
||||
(self.context, form_request),
|
||||
name=u"comment-form"
|
||||
)
|
||||
|
||||
commentForm.update()
|
||||
data, errors = commentForm.extractData() # pylint: disable-msg=W0612
|
||||
self.assertEqual(len(errors), 0)
|
||||
self.assertFalse(commentForm.handleComment(commentForm, "foo"))
|
||||
|
||||
# Delete the last comment
|
||||
conversation = IConversation(self.context)
|
||||
comment = [x for x in conversation.getComments()][-1]
|
||||
deleteView = getMultiAdapter(
|
||||
(comment, self.request),
|
||||
name=u"moderate-delete-comment"
|
||||
)
|
||||
# try to delete last comment without "Delete comments" permission
|
||||
setRoles(self.portal, TEST_USER_ID, ['Member'])
|
||||
self.assertRaises(Unauthorized, comment.restrictedTraverse, "@@moderate-delete-comment")
|
||||
deleteView()
|
||||
self.assertEqual(1, len([x for x in conversation.getComments()]))
|
||||
# try to delete last comment with "Delete comments" permission
|
||||
setRoles(self.portal, TEST_USER_ID, ['Reviewer'])
|
||||
deleteView()
|
||||
self.assertEqual(0, len([x for x in conversation.getComments()]))
|
||||
setRoles(self.portal, TEST_USER_ID, ['Manager'])
|
||||
|
||||
def test_add_anonymous_comment(self):
|
||||
self.portal.doc1.allow_discussion = True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user