Changeset 3114 in products for quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests
- Timestamp:
- Apr 14, 2011 4:45:57 PM (13 years ago)
- Location:
- quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/base.py
r3112 r3114 4 4 5 5 from Testing import ZopeTestCase as ztc 6 from AccessControl.SecurityManagement import newSecurityManager, \7 noSecurityManager8 9 6 from Products.PloneTestCase import PloneTestCase as ptc 10 from Products.PloneTestCase.layer import onsetup, PloneSiteLayer 11 from Products.CMFCore.utils import getToolByName 7 from Products.PloneTestCase.layer import onsetup 12 8 13 9 from quintagroup.plonecomments.tests.config import PRODUCT -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsCommenting.py
r3113 r3114 16 16 self.request = self.app.REQUEST 17 17 18 18 # VERY IMPORTANT to guarantee product skin's content visibility 19 19 self._refreshSkinData() 20 20 … … 23 23 for user_id in USERS.keys(): 24 24 self.membership.addMember(user_id, USERS[user_id]['passw'], 25 25 USERS[user_id]['roles'], []) 26 26 27 27 # Add users to Discussion Manager group 28 28 portal_groups = getToolByName(self.portal, 'portal_groups') 29 29 dm_group = portal_groups.getGroupById('DiscussionManager') 30 dm_users =[dm_group.addMember(u) for u in DM_USERS_IDS]30 [dm_group.addMember(u) for u in DM_USERS_IDS] 31 31 32 32 # Allow discussion for Document … … 71 71 replies_after = len(self.discussion.getDiscussionFor(doc_obj).getReplies()) 72 72 self.failUnless(replies_after-replies_before, 73 73 "Anonymous user CAN'T really add comment in terned ON *Anonymous commenting mode*.") 74 74 75 75 def testAddCommentToDocNotAnonymUsers(self): … … 119 119 self.login(u) 120 120 self.assertRaises(Unauthorized, doc_obj.discussion_reply, 121 121 "%s's reply" % u, "text of '%s' reply" % u) 122 122 self.login('dm_admin') 123 123 replies_after = self.discussion.getDiscussionFor(doc_obj).getReplies() … … 126 126 failed_users.append(u) 127 127 self.failIf(failed_users, 128 129 128 "%s user(s) CAN really add comment in terned OFF " 129 "*Anonymous commenting mode*." % failed_users) 130 130 131 131 … … 151 151 failed_users.append(u) 152 152 self.failIf(failed_users, 153 154 153 "%s - user(s) can not really add commentin terned OFF " 154 "*Anonymous commenting mode*." % failed_users) 155 155 156 156 … … 194 194 failed_users.append(u) 195 195 self.failIf(failed_users, 196 196 "%s - member(s) of DiscussionManager group CAN'T really ADD comment" % failed_users) 197 197 198 198 # This is actual only in terned OFF *Anonymous commenting mode* … … 210 210 failed_users.append(u) 211 211 self.failIf(failed_users, 212 213 212 "%s user(s) CAN really add comment in terned OFF " 213 "*Anonymous commenting mode*." % failed_users) 214 214 215 215 """ … … 263 263 failed_users.append(u) 264 264 self.failIf(failed_users, 265 265 "%s - user(s) can not really add comment to PUBLISHED reply." % failed_users) 266 266 267 267 # 3.Check adding reply to reply for illegal users … … 274 274 self.discussion.getDiscussionFor(reply) 275 275 self.assertRaises(Unauthorized, reply.discussion_reply, 276 276 "Reply %s" % u, "text of %s reply" % u) 277 277 278 278 … … 304 304 self.discussion.getDiscussionFor(doc_obj) 305 305 doc_obj.discussion_reply("A Reply to '%s'" % self.doc_moder_off_id, 306 306 "text of reply to '%s'" % self.doc_moder_off_id) 307 307 308 308 … … 330 330 failed_users.append(u) 331 331 self.failIf(failed_users , 332 333 332 "%s - member(s) CAN'T really ADD comment in terned off" 333 " comments Moderation mode." % failed_users) 334 334 335 335 … … 350 350 self.discussion.getDiscussionFor(reply_to_doc) 351 351 self.assertRaises(Unauthorized, reply_to_doc.discussion_reply, 352 352 "%s's reply" % u, "text of '%s' reply" % u) 353 353 354 354 -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsConfiglet.py
r3113 r3114 21 21 portal_groups = getToolByName(self.portal, 'portal_groups') 22 22 dm_group = portal_groups.getGroupById('DiscussionManager') 23 dm_users =[dm_group.addMember(u) for u in DM_USERS_IDS]23 [dm_group.addMember(u) for u in DM_USERS_IDS] 24 24 25 25 … … 61 61 62 62 # Add testing document to portal 63 my_doc =self.portal.invokeFactory('Document', id='my_doc')63 self.portal.invokeFactory('Document', id='my_doc') 64 64 self.my_doc = self.portal['my_doc'] 65 65 self.my_doc.edit(text_format='plain', text='hello world') 66 66 67 67 def testAnonymousCommenting(self): 68 getPortalReplyPerm = self.portal.rolesOfPermission69 68 def getReplyRoles(): 70 return [r['name'] for r in getPortalReplyPerm(ReplyToItem) if r['selected']=='SELECTED'] 69 return [r['name'] 70 for r in self.portal.rolesOfPermission(ReplyToItem) 71 if r['selected'] == 'SELECTED'] 71 72 # Simulate switching ON Anonymous Commenting 72 73 self.request.form['enable_anonymous_commenting'] = 'True' -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsModeration.py
r3112 r3114 204 204 for u in managers: 205 205 self.login(u) 206 auth = '%s:%s' % (u,USERS[u]['passw'])207 206 doc_id = "doc_%s" % u 208 207 doc_obj = getattr(self.portal, doc_id) -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsNotification.py
r3113 r3114 27 27 def afterSetUp(self): 28 28 self.portal._original_MailHost = self.portal.MailHost 29 self.portal.MailHost = mailhost =MockMailHost('MailHost')29 self.portal.MailHost = MockMailHost('MailHost') 30 30 31 31 self.loginAsPortalOwner() … … 62 62 63 63 # Add testing document to portal 64 my_doc =self.portal.invokeFactory('Document', id='my_doc', title='Doc')64 self.portal.invokeFactory('Document', id='my_doc', title='Doc') 65 65 self.my_doc = self.portal['my_doc'] 66 66 self.my_doc.edit(text_format='plain', text='hello world') … … 126 126 reply = self.discussion.getDiscussionFor(self.my_doc).getReplies()[0] 127 127 reply.discussion_reply('A Reply for comment' ,'text of reply for comment') 128 reply_for_comment =self.discussion.getDiscussionFor(self.my_doc).getReplies()[0]128 self.discussion.getDiscussionFor(self.my_doc).getReplies()[0] 129 129 self.failUnless(testMailExistance(self), 'Mail was not sended when enable_reply_user_notification.') 130 130 -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsNotificationRecipients.py
r3113 r3114 40 40 def afterSetUp(self): 41 41 self.portal._original_MailHost = self.portal.MailHost 42 self.portal.MailHost = mailhost =MockMailHost('MailHost')42 self.portal.MailHost = MockMailHost('MailHost') 43 43 44 44 self.loginAsPortalOwner() -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/testQPloneCommentsReportAbuse.py
r3113 r3114 1 from Products.CMFCore.utils import getToolByName2 1 from quintagroup.plonecomments.tests.testQPloneCommentsCommenting import \ 3 2 TestCommBase 4 from zExceptions import Unauthorized5 3 6 4 -
quintagroup.plonecomments/trunk/quintagroup/plonecomments/tests/tests.py
r965 r3114 1 1 import unittest 2 2 3 from zope.testing import doctestunit 4 from zope.component import testing 5 from Testing import ZopeTestCase as ztc 6 7 from base import getToolByName, TestCase 3 #from zope.testing import doctestunit 4 #from zope.component import testing 5 #from Testing import ZopeTestCase as ztc 6 #from base import TestCase 8 7 9 8 def test_suite():
Note: See TracChangeset
for help on using the changeset viewer.