[832] | 1 | # |
---|
| 2 | # Test adding comments possibility on switching on/off moderation |
---|
| 3 | # |
---|
| 4 | |
---|
[3113] | 5 | from Products.CMFCore.utils import getToolByName |
---|
[832] | 6 | from zExceptions import Unauthorized |
---|
[3112] | 7 | from quintagroup.plonecomments.tests.base import FunctionalTestCase |
---|
| 8 | from quintagroup.plonecomments.tests.config import USERS, PROPERTY_SHEET, \ |
---|
| 9 | DM_USERS_IDS, COMMON_USERS_IDS |
---|
[832] | 10 | |
---|
| 11 | |
---|
| 12 | class TestCommBase(FunctionalTestCase): |
---|
| 13 | |
---|
| 14 | def afterSetUp(self): |
---|
| 15 | self.loginAsPortalOwner() |
---|
| 16 | self.request = self.app.REQUEST |
---|
| 17 | |
---|
[3114] | 18 | # VERY IMPORTANT to guarantee product skin's content visibility |
---|
[832] | 19 | self._refreshSkinData() |
---|
| 20 | |
---|
| 21 | # Add all users |
---|
| 22 | self.membership = getToolByName(self.portal, 'portal_membership', None) |
---|
| 23 | for user_id in USERS.keys(): |
---|
[880] | 24 | self.membership.addMember(user_id, USERS[user_id]['passw'], |
---|
[3114] | 25 | USERS[user_id]['roles'], []) |
---|
[832] | 26 | |
---|
| 27 | # Add users to Discussion Manager group |
---|
| 28 | portal_groups = getToolByName(self.portal, 'portal_groups') |
---|
| 29 | dm_group = portal_groups.getGroupById('DiscussionManager') |
---|
[3114] | 30 | [dm_group.addMember(u) for u in DM_USERS_IDS] |
---|
[832] | 31 | |
---|
| 32 | # Allow discussion for Document |
---|
| 33 | portal_types = getToolByName(self.portal, 'portal_types', None) |
---|
| 34 | doc_fti = portal_types.getTypeInfo('Document') |
---|
| 35 | doc_fti._updateProperty('allow_discussion', 1) |
---|
| 36 | |
---|
| 37 | # Make sure Documents are visible by default |
---|
| 38 | # XXX only do this for plone 3 |
---|
[3126] | 39 | self.portal.portal_workflow.setChainForPortalTypes(('Document',), |
---|
| 40 | 'plone_workflow') |
---|
[832] | 41 | |
---|
| 42 | # Add testing documents to portal. Add one document for avery user. |
---|
[3126] | 43 | # For testing behaviors, where made some changes to document state |
---|
| 44 | # it's more usefull. |
---|
| 45 | self.discussion = getToolByName(self.portal, 'portal_discussion', |
---|
| 46 | None) |
---|
[832] | 47 | self.all_users_id = DM_USERS_IDS + COMMON_USERS_IDS |
---|
| 48 | for user_id in self.all_users_id: |
---|
| 49 | doc_id = 'doc_%s' % user_id |
---|
| 50 | self.portal.invokeFactory('Document', id=doc_id) |
---|
| 51 | doc_obj = getattr(self.portal, doc_id) |
---|
[3126] | 52 | doc_obj.edit(text_format='plain', |
---|
| 53 | text='hello world from %s' % doc_id) |
---|
[832] | 54 | # Create talkback for document and Add comment to doc_obj |
---|
| 55 | self.discussion.getDiscussionFor(doc_obj) |
---|
[3126] | 56 | doc_obj.discussion_reply('A Reply for %s' % doc_id, |
---|
| 57 | 'text of reply for %s' % doc_id) |
---|
[832] | 58 | |
---|
| 59 | |
---|
| 60 | class TestMixinAnonymOn: |
---|
| 61 | |
---|
| 62 | def afterSetUp(self): |
---|
| 63 | pass |
---|
| 64 | |
---|
| 65 | def testAddCommentToDocAnonymUsers(self): |
---|
[880] | 66 | |
---|
[832] | 67 | # ADDING COMMENTS MUST ALLOWED for anonymous users |
---|
| 68 | self.login('dm_admin') |
---|
| 69 | doc_obj = getattr(self.portal, "doc_anonym") |
---|
[3126] | 70 | discussion_for = self.discussion.getDiscussionFor(doc_obj) |
---|
| 71 | replies_before = len(discussion_for.getReplies()) |
---|
[880] | 72 | |
---|
[832] | 73 | # Create talkback for document and Add comment |
---|
| 74 | self.logout() |
---|
| 75 | doc_obj.discussion_reply("Anonym reply", "text of 'anonym' reply") |
---|
| 76 | self.login('dm_admin') |
---|
[3126] | 77 | replies_after = len(discussion_for.getReplies()) |
---|
[3119] | 78 | self.failUnless(replies_after - replies_before, |
---|
[3126] | 79 | "Anonymous user CAN'T really add comment in terned ON " |
---|
| 80 | "*Anonymous commenting mode*.") |
---|
[832] | 81 | |
---|
| 82 | def testAddCommentToDocNotAnonymUsers(self): |
---|
[880] | 83 | |
---|
[832] | 84 | # All users CAN ADD COMMENTS |
---|
[3120] | 85 | not_anonym_users = [u for u in self.all_users_id if not u == 'anonym'] |
---|
[832] | 86 | failed_users = [] |
---|
| 87 | for u in not_anonym_users: |
---|
| 88 | self.login('dm_admin') |
---|
| 89 | doc_id = "doc_%s" % u |
---|
| 90 | doc_obj = getattr(self.portal, doc_id) |
---|
[3126] | 91 | discussion_for = self.discussion.getDiscussionFor(doc_obj) |
---|
| 92 | replies_before = discussion_for.getReplies() |
---|
[832] | 93 | self.login(u) |
---|
[880] | 94 | |
---|
[832] | 95 | # Create talkback for document and Add comment |
---|
[3126] | 96 | doc_obj.discussion_reply("%s's reply" % u, |
---|
| 97 | "text of '%s' reply" % u) |
---|
[880] | 98 | |
---|
[832] | 99 | # Check is comment added |
---|
| 100 | self.login('dm_admin') |
---|
[3126] | 101 | replies_after = discussion_for.getReplies() |
---|
[832] | 102 | disparity = len(replies_after) - len(replies_before) |
---|
| 103 | if not disparity: |
---|
| 104 | failed_users.append(u) |
---|
[3126] | 105 | self.failIf(failed_users, |
---|
| 106 | "%s - user(s) can not really add comment." % failed_users) |
---|
[832] | 107 | |
---|
| 108 | |
---|
| 109 | class TestMixinAnonymOff: |
---|
| 110 | |
---|
| 111 | def afterSetUp(self): |
---|
| 112 | all_users_id = DM_USERS_IDS + COMMON_USERS_IDS |
---|
| 113 | self.not_like_anonym = ['admin', 'member', 'dm_admin', 'dm_member'] |
---|
[3126] | 114 | self.like_anonym = [u |
---|
| 115 | for u in all_users_id |
---|
| 116 | if u not in self.not_like_anonym] |
---|
[832] | 117 | |
---|
| 118 | def testAddCommentToDocLikeAnonymUsers(self): |
---|
[880] | 119 | |
---|
[832] | 120 | # ADDING COMMENTS MUST REFUSED for anonymous users |
---|
| 121 | failed_users = [] |
---|
| 122 | for u in self.like_anonym: |
---|
| 123 | self.login('dm_admin') |
---|
| 124 | doc_obj = getattr(self.portal, "doc_%s" % u) |
---|
[3126] | 125 | discussion_for = self.discussion.getDiscussionFor(doc_obj) |
---|
| 126 | replies_before = discussion_for.getReplies() |
---|
[880] | 127 | |
---|
[832] | 128 | # Create talkback for document and Add comment |
---|
| 129 | self.logout() |
---|
[3126] | 130 | if not u == 'anonym': |
---|
[832] | 131 | self.login(u) |
---|
[880] | 132 | self.assertRaises(Unauthorized, doc_obj.discussion_reply, |
---|
[3114] | 133 | "%s's reply" % u, "text of '%s' reply" % u) |
---|
[832] | 134 | self.login('dm_admin') |
---|
[3126] | 135 | replies_after = discussion_for.getReplies() |
---|
[832] | 136 | disparity = len(replies_after) - len(replies_before) |
---|
| 137 | if disparity: |
---|
| 138 | failed_users.append(u) |
---|
[880] | 139 | self.failIf(failed_users, |
---|
[3114] | 140 | "%s user(s) CAN really add comment in terned OFF " |
---|
| 141 | "*Anonymous commenting mode*." % failed_users) |
---|
[832] | 142 | |
---|
| 143 | def testAddCommentToDocNotLikeAnonymUsers(self): |
---|
[880] | 144 | |
---|
[832] | 145 | # All users CAN ADD COMMENTS |
---|
| 146 | failed_users = [] |
---|
| 147 | for u in self.not_like_anonym: |
---|
| 148 | self.login('dm_admin') |
---|
| 149 | doc_id = "doc_%s" % u |
---|
| 150 | doc_obj = getattr(self.portal, doc_id) |
---|
[3126] | 151 | discussion_for = self.discussion.getDiscussionFor(doc_obj) |
---|
| 152 | replies_before = discussion_for.getReplies() |
---|
[832] | 153 | self.login(u) |
---|
[880] | 154 | |
---|
[832] | 155 | # Create talkback for document and Add comment |
---|
[3126] | 156 | doc_obj.discussion_reply("%s's reply" % u, |
---|
| 157 | "text of '%s' reply" % u) |
---|
[880] | 158 | |
---|
[832] | 159 | # Check is comment added |
---|
| 160 | self.login('dm_admin') |
---|
[3126] | 161 | replies_after = discussion_for.getReplies() |
---|
[832] | 162 | disparity = len(replies_after) - len(replies_before) |
---|
| 163 | if not disparity: |
---|
| 164 | failed_users.append(u) |
---|
[880] | 165 | self.failIf(failed_users, |
---|
[3114] | 166 | "%s - user(s) can not really add commentin terned OFF " |
---|
| 167 | "*Anonymous commenting mode*." % failed_users) |
---|
[832] | 168 | |
---|
| 169 | |
---|
| 170 | class TestMixinModerationOn: |
---|
| 171 | |
---|
| 172 | def afterSetUp(self): |
---|
[880] | 173 | |
---|
[832] | 174 | # Get Moderation state |
---|
| 175 | pp = getToolByName(self.portal, 'portal_properties') |
---|
[880] | 176 | config_ps = getattr(pp, PROPERTY_SHEET, None) |
---|
[832] | 177 | EnableAnonymComm = getattr(config_ps, "enable_anonymous_commenting") |
---|
[880] | 178 | |
---|
[832] | 179 | # Group users depending on Anonymous commenting enabling/disabling |
---|
| 180 | if EnableAnonymComm: |
---|
| 181 | self.allowable_dm_users = DM_USERS_IDS |
---|
| 182 | self.allowable_common_users = COMMON_USERS_IDS |
---|
| 183 | self.illegal_dm_users = [] |
---|
| 184 | self.illegal_common_users = [] |
---|
| 185 | else: |
---|
| 186 | self.allowable_dm_users = ['dm_admin', 'dm_member'] |
---|
| 187 | self.allowable_common_users = ['admin', 'member'] |
---|
[3126] | 188 | self.illegal_dm_users = [u |
---|
| 189 | for u in DM_USERS_IDS |
---|
| 190 | if not u in self.allowable_dm_users] |
---|
| 191 | self.illegal_common_users = [u |
---|
| 192 | for u in COMMON_USERS_IDS |
---|
| 193 | if not u in self.allowable_common_users] |
---|
[832] | 194 | |
---|
| 195 | def testAddCommentToNotPublishedReplyDMUsers(self): |
---|
[880] | 196 | |
---|
[3126] | 197 | # DiscussionManager's group's members with Manager or Member roles |
---|
| 198 | # CAN ADD COMMENTS to reply IN ANY STATE (published/not published) |
---|
[832] | 199 | failed_users = [] |
---|
| 200 | for u in self.allowable_dm_users: |
---|
| 201 | self.login(u) |
---|
| 202 | doc_obj = getattr(self.portal, "doc_%s" % u) |
---|
| 203 | # Get reply to this document |
---|
| 204 | reply = self.discussion.getDiscussionFor(doc_obj).getReplies()[0] |
---|
| 205 | # Create talkback for reply and Add comment |
---|
| 206 | self.discussion.getDiscussionFor(reply) |
---|
| 207 | reply.discussion_reply("%s's reply" % u, "text of '%s' reply" % u) |
---|
[3126] | 208 | discussion_for = self.discussion.getDiscussionFor(reply) |
---|
| 209 | replies_to_reply = discussion_for.getReplies() |
---|
[832] | 210 | if not replies_to_reply: |
---|
| 211 | failed_users.append(u) |
---|
[3126] | 212 | self.failIf(failed_users, "%s - member(s) of DiscussionManager group " |
---|
| 213 | "CAN'T really ADD comment" % failed_users) |
---|
[880] | 214 | |
---|
[832] | 215 | # This is actual only in terned OFF *Anonymous commenting mode* |
---|
| 216 | failed_users = [] |
---|
| 217 | for u in self.illegal_dm_users: |
---|
| 218 | self.login(u) |
---|
| 219 | doc_obj = getattr(self.portal, "doc_%s" % u) |
---|
| 220 | # Get reply to this document |
---|
| 221 | reply = self.discussion.getDiscussionFor(doc_obj).getReplies()[0] |
---|
| 222 | # Create talkback for reply and Add comment |
---|
| 223 | self.discussion.getDiscussionFor(reply) |
---|
[3126] | 224 | self.assertRaises(Unauthorized, reply.discussion_reply, |
---|
| 225 | "%s's reply" % u, "text of '%s' reply" % u) |
---|
| 226 | discussion_for = self.discussion.getDiscussionFor(reply) |
---|
| 227 | replies_to_reply = discussion_for.getReplies() |
---|
[832] | 228 | if replies_to_reply: |
---|
| 229 | failed_users.append(u) |
---|
[880] | 230 | self.failIf(failed_users, |
---|
[3114] | 231 | "%s user(s) CAN really add comment in terned OFF " |
---|
| 232 | "*Anonymous commenting mode*." % failed_users) |
---|
[832] | 233 | |
---|
| 234 | """ |
---|
| 235 | def testAddCommentToNotPublishedReplyNotDMUsers(self): |
---|
| 236 | # Users without DiscussionManager role CAN'T ACCESS an so ADD COMMENTS |
---|
| 237 | # TO NOT PUBLISHED reply. |
---|
| 238 | manager = 'dm_admin' |
---|
| 239 | for u in self.allowable_common_users: |
---|
| 240 | self.login(manager) |
---|
| 241 | doc_obj = getattr(self.portal, "doc_%s" % u) |
---|
| 242 | reply = self.discussion.getDiscussionFor(doc_obj).getReplies()[0] |
---|
[3126] | 243 | discussion_for = self.discussion.getDiscussionFor(reply) |
---|
| 244 | reply_to_reply = discussion_for.getReplies() |
---|
[832] | 245 | reply_to_reply_before = len(reply_to_reply) |
---|
| 246 | self.logout() |
---|
| 247 | if not u=='anonym': |
---|
| 248 | self.login(u) |
---|
[3126] | 249 | # On adding reply to not published reply MUST generte |
---|
| 250 | # Unauthorized exception |
---|
| 251 | self.assertRaises(Unauthorized, reply.discussion_reply, |
---|
| 252 | "Reply %s" % u, "text of %s reply" % u) |
---|
[832] | 253 | """ |
---|
| 254 | |
---|
| 255 | def testAddCommentToPublishedReplyALLUsers(self): |
---|
[880] | 256 | |
---|
[832] | 257 | # All users CAN ADD COMMENTS to published reply |
---|
| 258 | manager = 'dm_admin' |
---|
| 259 | allowable_users = self.allowable_dm_users + self.allowable_common_users |
---|
| 260 | illegal_users = self.illegal_dm_users + self.illegal_common_users |
---|
| 261 | all_users = allowable_users + illegal_users |
---|
[880] | 262 | |
---|
[832] | 263 | # 1. Publish comments |
---|
| 264 | self.login(manager) |
---|
| 265 | for u in all_users: |
---|
| 266 | doc_obj = getattr(self.portal, "doc_%s" % u) |
---|
| 267 | reply = self.discussion.getDiscussionFor(doc_obj).getReplies()[0] |
---|
| 268 | reply.discussion_publish_comment() |
---|
[880] | 269 | |
---|
[832] | 270 | # 2.Check adding reply to reply for allowable users |
---|
| 271 | failed_users = [] |
---|
| 272 | for u in allowable_users: |
---|
| 273 | self.logout() |
---|
[3126] | 274 | if not u == 'anonym': |
---|
[832] | 275 | self.login(u) |
---|
[880] | 276 | |
---|
[832] | 277 | # Create talkback for document and Add comment |
---|
| 278 | self.discussion.getDiscussionFor(reply) |
---|
| 279 | reply.discussion_reply("Reply %s" % u, "text of %s reply" % u) |
---|
[880] | 280 | |
---|
[832] | 281 | # Check is comment added |
---|
| 282 | self.login(manager) |
---|
[3126] | 283 | discussion_for = self.discussion.getDiscussionFor(reply) |
---|
| 284 | reply_to_reply = discussion_for.getReplies() |
---|
[832] | 285 | if not reply_to_reply: |
---|
| 286 | failed_users.append(u) |
---|
[3126] | 287 | self.failIf(failed_users, "%s - user(s) can not really add comment to" |
---|
| 288 | " PUBLISHED reply." % failed_users) |
---|
[880] | 289 | |
---|
[832] | 290 | # 3.Check adding reply to reply for illegal users |
---|
| 291 | for u in illegal_users: |
---|
| 292 | self.logout() |
---|
[3126] | 293 | if not u == 'anonym': |
---|
[832] | 294 | self.login(u) |
---|
[880] | 295 | |
---|
[3126] | 296 | # On adding reply to not published reply MUST generte |
---|
| 297 | # Unauthorized exception |
---|
[832] | 298 | self.discussion.getDiscussionFor(reply) |
---|
[880] | 299 | self.assertRaises(Unauthorized, reply.discussion_reply, |
---|
[3114] | 300 | "Reply %s" % u, "text of %s reply" % u) |
---|
[832] | 301 | |
---|
| 302 | |
---|
| 303 | class TestMixinModerationOff: |
---|
| 304 | |
---|
| 305 | def afterSetUp(self): |
---|
[880] | 306 | |
---|
[832] | 307 | # Get Moderation state |
---|
| 308 | pp = getToolByName(self.portal, 'portal_properties') |
---|
[880] | 309 | config_ps = getattr(pp, PROPERTY_SHEET, None) |
---|
[832] | 310 | EnableAnonymComm = getattr(config_ps, "enable_anonymous_commenting") |
---|
[880] | 311 | |
---|
[832] | 312 | # Group users depending on Anonymous commenting enabling/disabling |
---|
| 313 | if EnableAnonymComm: |
---|
| 314 | self.allowable_users = DM_USERS_IDS + COMMON_USERS_IDS |
---|
| 315 | self.illegal_users = [] |
---|
| 316 | else: |
---|
| 317 | self.allowable_users = ['dm_admin', 'dm_member', 'admin', 'member'] |
---|
[3126] | 318 | self.illegal_users = [u |
---|
| 319 | for u in self.all_users_id |
---|
| 320 | if not u in self.allowable_users] |
---|
[832] | 321 | |
---|
| 322 | # Add testing document to portal in Moderation OFF mode. |
---|
| 323 | self.discussion = getToolByName(self.portal, 'portal_discussion', None) |
---|
| 324 | self.doc_moder_off_id = 'doc_moderation_off' |
---|
| 325 | self.portal.invokeFactory('Document', id=self.doc_moder_off_id) |
---|
| 326 | doc_obj = getattr(self.portal, self.doc_moder_off_id) |
---|
[3126] | 327 | doc_obj.edit(text_format='plain', |
---|
| 328 | text='hello world from in moderation off mode') |
---|
[880] | 329 | |
---|
[832] | 330 | # Create talkback for document and Add comment to 'doc_moderatio_off' |
---|
| 331 | self.discussion.getDiscussionFor(doc_obj) |
---|
[880] | 332 | doc_obj.discussion_reply("A Reply to '%s'" % self.doc_moder_off_id, |
---|
[3114] | 333 | "text of reply to '%s'" % self.doc_moder_off_id) |
---|
[832] | 334 | |
---|
| 335 | def testAddCommentToReplyAllowableUsers(self): |
---|
[880] | 336 | |
---|
[832] | 337 | # Users CAN ADD COMMENTS |
---|
| 338 | failed_users = [] |
---|
| 339 | for u in self.allowable_users: |
---|
| 340 | self.logout() |
---|
[3126] | 341 | if not u == 'anonym': |
---|
[832] | 342 | self.login(u) |
---|
| 343 | doc_obj = getattr(self.portal, self.doc_moder_off_id) |
---|
[880] | 344 | |
---|
[832] | 345 | # Get reply to this document |
---|
[3126] | 346 | discussion_for = self.discussion.getDiscussionFor(doc_obj) |
---|
| 347 | reply_to_doc = discussion_for.getReplies()[0] |
---|
[880] | 348 | |
---|
[832] | 349 | # Create talkback for reply and Add comment |
---|
[3126] | 350 | discussion_for = self.discussion.getDiscussionFor(reply_to_doc) |
---|
| 351 | replies_before = discussion_for.getReplies() |
---|
[832] | 352 | if not replies_before: |
---|
| 353 | self.discussion.getDiscussionFor(reply_to_doc) |
---|
[3126] | 354 | reply_to_doc.discussion_reply("%s's reply" % u, |
---|
| 355 | "text of '%s' reply" % u) |
---|
| 356 | replies_after = discussion_for.getReplies() |
---|
[832] | 357 | disparity = len(replies_after) - len(replies_before) |
---|
| 358 | if not disparity: |
---|
| 359 | failed_users.append(u) |
---|
[3116] | 360 | self.failIf(failed_users, |
---|
[3114] | 361 | "%s - member(s) CAN'T really ADD comment in terned off" |
---|
| 362 | " comments Moderation mode." % failed_users) |
---|
[832] | 363 | |
---|
| 364 | def testAddCommentToReplyIllegalUsers(self): |
---|
[880] | 365 | |
---|
[832] | 366 | # This users CAN'T ADD COMMENTS |
---|
| 367 | # This is actual only in terned OFF *Anonymous commenting mode* |
---|
| 368 | for u in self.illegal_users: |
---|
| 369 | self.logout() |
---|
[3126] | 370 | if not u == 'anonym': |
---|
[832] | 371 | self.login(u) |
---|
| 372 | doc_obj = getattr(self.portal, self.doc_moder_off_id) |
---|
[880] | 373 | |
---|
[832] | 374 | # Get reply to this document |
---|
[3126] | 375 | discussion_for = self.discussion.getDiscussionFor(doc_obj) |
---|
| 376 | reply_to_doc = discussion_for.getReplies()[0] |
---|
[880] | 377 | |
---|
[832] | 378 | # Create talkback for reply and Add comment |
---|
| 379 | self.discussion.getDiscussionFor(reply_to_doc) |
---|
[880] | 380 | self.assertRaises(Unauthorized, reply_to_doc.discussion_reply, |
---|
[3114] | 381 | "%s's reply" % u, "text of '%s' reply" % u) |
---|
[832] | 382 | |
---|
| 383 | |
---|
[3126] | 384 | class TestModerationAnonymComm(TestCommBase, TestMixinAnonymOn, |
---|
| 385 | TestMixinModerationOn): |
---|
[832] | 386 | |
---|
| 387 | def afterSetUp(self): |
---|
| 388 | TestCommBase.afterSetUp(self) |
---|
[880] | 389 | |
---|
[832] | 390 | # Preparation for functional testing |
---|
| 391 | # Tern On Moderation and tern on Anonymous commenting |
---|
| 392 | self.request.form['enable_anonymous_commenting'] = 'True' |
---|
| 393 | self.request.form['enable_moderation'] = 'True' |
---|
| 394 | self.portal.prefs_comments_setup() |
---|
[880] | 395 | |
---|
[832] | 396 | # Initialize base classes |
---|
| 397 | TestMixinAnonymOn.afterSetUp(self) |
---|
| 398 | TestMixinModerationOn.afterSetUp(self) |
---|
| 399 | |
---|
| 400 | |
---|
[3126] | 401 | class TestModerationOFFAnonymComm(TestCommBase, TestMixinAnonymOff, |
---|
| 402 | TestMixinModerationOn): |
---|
[832] | 403 | |
---|
| 404 | def afterSetUp(self): |
---|
| 405 | TestCommBase.afterSetUp(self) |
---|
[880] | 406 | |
---|
[832] | 407 | # Preparation for functional testing |
---|
| 408 | # Tern On Moderation and tern off Anonymous commenting |
---|
| 409 | self.request.form['enable_moderation'] = 'True' |
---|
| 410 | self.portal.prefs_comments_setup() |
---|
[880] | 411 | |
---|
[832] | 412 | # Initialize base classes |
---|
| 413 | TestMixinAnonymOff.afterSetUp(self) |
---|
| 414 | TestMixinModerationOn.afterSetUp(self) |
---|
| 415 | |
---|
| 416 | |
---|
[3126] | 417 | class TestAnonymCommOFFModeration(TestCommBase, TestMixinAnonymOn, |
---|
| 418 | TestMixinModerationOff): |
---|
[832] | 419 | |
---|
| 420 | def afterSetUp(self): |
---|
| 421 | TestCommBase.afterSetUp(self) |
---|
[880] | 422 | |
---|
[832] | 423 | # Preparation for functional testing |
---|
| 424 | # Tern On Anonymous commenting and tern off Moderation |
---|
| 425 | self.request.form['enable_anonymous_commenting'] = 'True' |
---|
| 426 | self.portal.prefs_comments_setup() |
---|
[880] | 427 | |
---|
[832] | 428 | # Initialize base classes |
---|
| 429 | TestMixinAnonymOn.afterSetUp(self) |
---|
| 430 | TestMixinModerationOff.afterSetUp(self) |
---|
| 431 | |
---|
| 432 | |
---|
[3126] | 433 | class TestOFFModerationOFFAnonymComm(TestCommBase, TestMixinAnonymOff, |
---|
| 434 | TestMixinModerationOff): |
---|
[832] | 435 | |
---|
| 436 | def afterSetUp(self): |
---|
| 437 | TestCommBase.afterSetUp(self) |
---|
[880] | 438 | |
---|
[832] | 439 | # Preparation for functional testing |
---|
| 440 | # Tern Off Moderation and tern off Anonymous commenting |
---|
| 441 | self.portal.prefs_comments_setup() |
---|
[880] | 442 | |
---|
[832] | 443 | # Initialize base classes |
---|
| 444 | TestMixinAnonymOff.afterSetUp(self) |
---|
| 445 | TestMixinModerationOff.afterSetUp(self) |
---|
| 446 | |
---|
| 447 | |
---|
| 448 | def test_suite(): |
---|
| 449 | from unittest import TestSuite, makeSuite |
---|
| 450 | suite = TestSuite() |
---|
| 451 | suite.addTest(makeSuite(TestModerationAnonymComm)) |
---|
| 452 | suite.addTest(makeSuite(TestModerationOFFAnonymComm)) |
---|
| 453 | suite.addTest(makeSuite(TestAnonymCommOFFModeration)) |
---|
| 454 | suite.addTest(makeSuite(TestOFFModerationOFFAnonymComm)) |
---|
| 455 | |
---|
| 456 | return suite |
---|