[1] | 1 | # |
---|
| 2 | # Test 'Moderate Discussion' permission |
---|
| 3 | # |
---|
| 4 | |
---|
| 5 | import os, sys, string |
---|
| 6 | if __name__ == '__main__': |
---|
| 7 | execfile(os.path.join(sys.path[0], 'framework.py')) |
---|
| 8 | |
---|
| 9 | from Products.PloneTestCase import PloneTestCase |
---|
| 10 | from Products.CMFCore.utils import getToolByName |
---|
| 11 | from AccessControl import getSecurityManager |
---|
| 12 | |
---|
| 13 | PRODUCT = 'qPloneComments' |
---|
| 14 | PERM_NAME = 'Moderate Discussion' |
---|
| 15 | PloneTestCase.installProduct(PRODUCT) |
---|
| 16 | PloneTestCase.setupPloneSite() |
---|
| 17 | |
---|
| 18 | from Products.CMFDefault.DiscussionItem import DiscussionItemContainer |
---|
| 19 | |
---|
| 20 | class TestPermission(PloneTestCase.PloneTestCase): |
---|
| 21 | |
---|
| 22 | def afterSetUp(self): |
---|
| 23 | self.loginAsPortalOwner() |
---|
| 24 | self.portal.portal_quickinstaller.installProduct(PRODUCT) |
---|
| 25 | |
---|
| 26 | def test_install_moderate_discussion_permission(self): |
---|
| 27 | roles = [item['name'] for item in self.portal.rolesOfPermission(PERM_NAME) if item['selected'] == 'SELECTED'] |
---|
| 28 | self.assert_( roles != [], '%s not installed'%PERM_NAME) |
---|
| 29 | |
---|
| 30 | def test_deleteReply_permission(self): |
---|
| 31 | #dic = DiscussionItemContainer() |
---|
| 32 | #dic.createReply('Title', 'Text') |
---|
| 33 | pass |
---|
| 34 | |
---|
| 35 | def test_manager_moderation(self): |
---|
| 36 | pass |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | def test_suite(): |
---|
| 40 | from unittest import TestSuite, makeSuite |
---|
| 41 | suite = TestSuite() |
---|
| 42 | suite.addTest(makeSuite(TestPermission)) |
---|
| 43 | return suite |
---|
| 44 | |
---|
| 45 | if __name__ == '__main__': |
---|
| 46 | framework() |
---|
| 47 | |
---|