| | 65 | portal_properties = getToolByName(self.portal, 'portal_properties', None) |
|---|
| | 66 | self.prefs = portal_properties[PROPERTY_SHEET] |
|---|
| | 67 | self.request = self.app.REQUEST |
|---|
| | 68 | |
|---|
| | 69 | # Add Manager user - 'dm' and add him to Discussion Manager group |
|---|
| | 70 | self.portal.portal_membership.addMember('dm', 'secret' , ['Manager'], []) |
|---|
| | 71 | portal_groups = getToolByName(self.portal, 'portal_groups') |
|---|
| | 72 | dm_group = portal_groups.getGroupById(id='DiscussionManager') |
|---|
| | 73 | dm_group.addMember('dm') |
|---|
| | 74 | #self.logout() |
|---|
| | 75 | self.login('dm') |
|---|
| | 76 | # For prepare mail sending - enter an e-mail adress |
|---|
| | 77 | self.prefs._updateProperty('Email_Discussion_Manager', 'discussion.manager@test.com') |
|---|
| | 78 | member = self.portal.portal_membership.getAuthenticatedMember() |
|---|
| | 79 | member.setMemberProperties({'email':'creator@test.com'}) |
|---|
| | 80 | #self.fail(member.getMemberId()+' :: '+member.getUserName()+' :: '+str(member.getRoles())+' :: '+member.getProperty('email')) |
|---|
| | 81 | |
|---|
| 140 | | def testNotification(self): |
|---|
| 141 | | # For prepare mail sending - enter an e-mail adress |
|---|
| 142 | | self.prefs._updateProperty('Email_Discussion_Manager', 'wrong_email_addr') |
|---|
| 143 | | # Create talkback for document and Prepare REQUEST |
|---|
| 144 | | self.portal.portal_discussion.getDiscussionFor(self.my_doc) |
|---|
| 145 | | self.request.form['Creator'] = self.portal.portal_membership.getAuthenticatedMember().getUserName() |
|---|
| 146 | | self.request.form['subject'] = "Reply 1" |
|---|
| 147 | | self.request.form['body_text'] = "text of reply" |
|---|
| | 153 | def testApproveNotification(self): |
|---|
| | 154 | # Check ON Notification Anonymous Commenting |
|---|
| | 155 | self.request.form['Enable_Approve_Notification'] = 'True' |
|---|
| | 156 | self.portal.prefs_comments_setup() |
|---|
| | 157 | self.assert_(self.prefs.getProperty('Enable_Approve_Notification')==1,"Approve Notification not terned ON") |
|---|
| 149 | | # Check Notification ON |
|---|
| 150 | | self.assert_(self.prefs.getProperty('Enable_Notification')==1,"Notification not terned ON") |
|---|
| 151 | | self.assertRaises(socket.error, self.my_doc.discussion_reply, 'Reply 1', 'text of reply') |
|---|
| 152 | | # Check Notification OFF |
|---|
| 153 | | self.prefs._updateProperty('Enable_Notification', 0) |
|---|
| 154 | | self.assert_(self.prefs.getProperty('Enable_Notification')==0,"Notification not terned Off") |
|---|
| 155 | | try: |
|---|
| 156 | | self.my_doc.discussion_reply('Reply 1','text of reply') |
|---|
| 157 | | except socket.error: |
|---|
| 158 | | self.fail("Terning notification Off NOT work") |
|---|
| | 159 | # Check OFF Notification Anonymous Commenting |
|---|
| | 160 | if self.request.form.has_key('Enable_Approve_Notification'): |
|---|
| | 161 | del self.request.form['Enable_Approve_Notification'] |
|---|
| | 162 | self.portal.prefs_comments_setup() |
|---|
| | 163 | self.assert_(self.prefs.getProperty('Enable_Approve_Notification')==0,"Approve Notification not terned OFF") |
|---|
| | 164 | |
|---|
| | 165 | |
|---|
| | 166 | def testPublishedNotification(self): |
|---|
| | 167 | # Check ON Notification Anonymous Commenting |
|---|
| | 168 | self.request.form['Enable_Published_Notification'] = 'True' |
|---|
| | 169 | self.portal.prefs_comments_setup() |
|---|
| | 170 | self.assert_(self.prefs.getProperty('Enable_Published_Notification')==1,"Published Notification not terned ON") |
|---|
| | 171 | |
|---|
| | 172 | # Check OFF Notification Anonymous Commenting |
|---|
| | 173 | if self.request.form.has_key('Enable_Published_Notification'): |
|---|
| | 174 | del self.request.form['Enable_Published_Notification'] |
|---|
| | 175 | self.portal.prefs_comments_setup() |
|---|
| | 176 | self.assert_(self.prefs.getProperty('Enable_Published_Notification')==0,"Published Notification not terned OFF") |
|---|
| | 177 | |
|---|