Changeset 795
- Timestamp:
- 02/22/07 11:20:10
- Files:
-
- qPloneComments/trunk/tests/testQPloneCommentsNotification.py (modified) (3 diffs)
- qPloneComments/trunk/utils.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneComments/trunk/tests/testQPloneCommentsNotification.py
r794 r795 4 4 5 5 import os, sys, string 6 6 7 if __name__ == '__main__': 7 8 execfile(os.path.join(sys.path[0], 'framework.py')) … … 11 12 from Products.CMFCore.CMFCorePermissions import ManagePortal, ReplyToItem 12 13 from Products.MailHost.MailHost import MailBase 14 15 import re 16 17 from Products.qPloneComments.utils import getMsg 13 18 from helperNotify import * 14 19 … … 68 73 69 74 prepareMailSendTest() 70 71 def test_bug_parent_reply(self): 75 76 def test_bug_parent_reply(self): 72 77 setProperties(self.prefs, 'enable_reply_user_notification') 73 78 self.my_doc.discussion_reply('A Reply for my_doc' ,'text of reply for my_doc') 74 79 parent_reply = self.discussion.getDiscussionFor(self.my_doc).getReplies()[0] 75 80 parent_reply.discussion_reply('reply', 'text') 76 81 77 82 def test_bug_mistakable_names(self): 78 """ 79 cleanOutputDir() 80 setProperties(self.prefs, 'enable_reply_user_notification') 83 setProperties(self.prefs, 'enable_reply_user_notification') 81 84 self.my_doc.discussion_reply('A Reply for my_doc' ,'text of reply for my_doc') 82 85 parent_reply = self.discussion.getDiscussionFor(self.my_doc).getReplies()[0] 83 84 parent_reply._delProperty('userid') 85 86 parent_reply.discussion_reply('reply', 'text') 87 """ 86 87 args={'mto': 'user_email@gmail.com', 88 'mfrom': 'admin_email@gmail.com', 89 'obj': parent_reply, 90 'organization_name': 'org_name', 91 'name': parent_reply.Creator()} 92 93 msg = getMsg(self.portal, 'reply_notify_template', args) 94 patt = re.compile('\\n\\n([^,]*)') 95 m = patt.search(msg) 96 if m: 97 name = m.group(1) 98 self.assertEqual(parent_reply.Creator(), name) 99 else: 100 raise "No name" 88 101 89 102 def test_notificafion_disabled(self): qPloneComments/trunk/utils.py
r794 r795 49 49 sendMails(props, actions, 'onApprove') 50 50 51 def getMsg(context, template, args): 52 return getattr(context, template)(**args) 51 53 52 54 def send_email(reply, context, state): 53 def send(context, template, args):54 msg = getattr(context, template)(**args)55 return context.MailHost.send(msg)56 57 55 def getEmail(obj, context): 58 56 email = obj.getProperty('email', None) … … 151 149 152 150 if args: 153 return send(context, template, args) 154 else: 155 return 1 151 msg = getMsg(context, template, args) 152 context.MailHost.send(msg)
