From 45140c66db5fca88735556eaf322897a67838e9c Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Thu, 9 Dec 2010 10:58:32 +0000 Subject: [PATCH] Functional test for posting a comment as user without the 'Reply to item' permission added. svn path=/plone.app.discussion/trunk/; revision=46215 --- plone/app/discussion/testing.py | 8 +++++++ .../tests/functional_test_comments.txt | 24 ++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/plone/app/discussion/testing.py b/plone/app/discussion/testing.py index 076bf82..31abcc2 100644 --- a/plone/app/discussion/testing.py +++ b/plone/app/discussion/testing.py @@ -16,6 +16,8 @@ class PloneAppDiscussion(PloneSandboxLayer): USER_NAME = 'johndoe' USER_PASSWORD = 'secret' + MEMBER_NAME = 'janedoe' + MEMBER_PASSWORD = 'secret' USER_WITH_FULLNAME_NAME = 'jim' USER_WITH_FULLNAME_FULLNAME = 'Jim Fulton' USER_WITH_FULLNAME_PASSWORD = 'secret' @@ -38,6 +40,12 @@ class PloneAppDiscussion(PloneSandboxLayer): acl_users.userFolderAddUser( self.USER_NAME, self.USER_PASSWORD, + [], + [], + ) + acl_users.userFolderAddUser( + self.MEMBER_NAME, + self.MEMBER_PASSWORD, ['Member'], [], ) diff --git a/plone/app/discussion/tests/functional_test_comments.txt b/plone/app/discussion/tests/functional_test_comments.txt index 1421afc..c05508d 100644 --- a/plone/app/discussion/tests/functional_test_comments.txt +++ b/plone/app/discussion/tests/functional_test_comments.txt @@ -95,11 +95,33 @@ Check if comment has been added properly. >>> "Comment from admin" in browser.contents True - + Post a comment as user ---------------------- +Login as user (without the 'Member' role). + + >>> browser.open(portal_url + '/logout') + >>> browser.open(portal_url + '/login_form') + >>> browser.getControl(name='__ac_name').value = 'johndoe' + >>> browser.getControl(name='__ac_password').value = 'secret' + >>> browser.getControl(name='submit').click() + +Users without the 'Reply to item' permission will not see the comment form, +because they don't have the 'Reply to item' permission. By default, this +permission is only granted to the 'Member' role. + + >>> 'form.widgets.text' in browser.contents + False + + >>> 'form.buttons.comment' in browser.contents + False + + +Post a comment as member +------------------------ + Login as user 'jim'. >>> browser.open(portal_url + '/logout')