Functional test for posting a comment as user without the 'Reply to item' permission added.

svn path=/plone.app.discussion/trunk/; revision=46215
This commit is contained in:
Timo Stollenwerk 2010-12-09 10:58:32 +00:00
parent 0b1c831f70
commit 45140c66db
2 changed files with 31 additions and 1 deletions

View File

@ -16,6 +16,8 @@ class PloneAppDiscussion(PloneSandboxLayer):
USER_NAME = 'johndoe' USER_NAME = 'johndoe'
USER_PASSWORD = 'secret' USER_PASSWORD = 'secret'
MEMBER_NAME = 'janedoe'
MEMBER_PASSWORD = 'secret'
USER_WITH_FULLNAME_NAME = 'jim' USER_WITH_FULLNAME_NAME = 'jim'
USER_WITH_FULLNAME_FULLNAME = 'Jim Fulton' USER_WITH_FULLNAME_FULLNAME = 'Jim Fulton'
USER_WITH_FULLNAME_PASSWORD = 'secret' USER_WITH_FULLNAME_PASSWORD = 'secret'
@ -38,6 +40,12 @@ class PloneAppDiscussion(PloneSandboxLayer):
acl_users.userFolderAddUser( acl_users.userFolderAddUser(
self.USER_NAME, self.USER_NAME,
self.USER_PASSWORD, self.USER_PASSWORD,
[],
[],
)
acl_users.userFolderAddUser(
self.MEMBER_NAME,
self.MEMBER_PASSWORD,
['Member'], ['Member'],
[], [],
) )

View File

@ -95,11 +95,33 @@ Check if comment has been added properly.
>>> "Comment from admin" in browser.contents >>> "Comment from admin" in browser.contents
True True
Post a comment as user 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'. Login as user 'jim'.
>>> browser.open(portal_url + '/logout') >>> browser.open(portal_url + '/logout')