• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python notification.parse_smtp_message函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中trac.tests.notification.parse_smtp_message函数的典型用法代码示例。如果您正苦于以下问题:Python parse_smtp_message函数的具体用法?Python parse_smtp_message怎么用?Python parse_smtp_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parse_smtp_message函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_send_mail

    def test_send_mail(self):
        dir = resource_filename(__name__, os.path.join('..', 'htdocs'))
        files = [os.path.join(dir, f) for f in os.listdir(dir)]
        resources = []
        parent = Resource('repository', '')
        for f in files:
            res = Resource('source', f, parent=parent)
            resources.append(res)

        subjects = ('Re: åäö',
                    u'Re: åäö',
                    'Re: ascii',
                    )
        bodies = ('Here you gö (Här får du)',
                  u'Here you gö (Här får du)',
                  'Ascii body',
                  )
        for subject in subjects:
            subject = to_unicode(subject)
            for body in bodies:
                body = to_unicode(body)
                mail = self.sharesys.send_as_email("anonymous",
                                                   (u'Pöntus Enmärk',
                                                    '[email protected]'),
                                                   [(u'Pontus Enmark',
                                                     '[email protected]'),
                                                    (u'Pöntus Enmärk',
                                                     '[email protected]')],
                                                   subject,
                                                   body,
                                                   *resources)
                headers, sent_body = parse_smtp_message(self.server.get_message())
                assert 'utf-8' in sent_body.split('\n')[2]
                assert subject == headers['Subject'], headers
                assert os.path.basename(files[0]) in sent_body
开发者ID:CGI-define-and-primeportal,项目名称:trac-plugin-sourcesharing,代码行数:35,代码来源:test_sourcesharer.py


示例2: _validate_mimebody

 def _validate_mimebody(self, mime, ticket, newtk):
     """Body of a ticket notification message"""
     (mime_decoder, mime_name, mime_charset) = mime
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=newtk)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     self.failIf('MIME-Version' not in headers)
     self.failIf('Content-Type' not in headers)
     self.failIf('Content-Transfer-Encoding' not in headers)
     self.failIf(not re.compile(r"1.\d").match(headers['MIME-Version']))
     type_re = re.compile(r'^text/plain;\scharset="([\w\-\d]+)"$')
     charset = type_re.match(headers['Content-Type'])
     self.failIf(not charset)
     charset = charset.group(1)
     self.assertEqual(charset, mime_charset)
     self.assertEqual(headers['Content-Transfer-Encoding'], mime_name)
     # checks the width of each body line
     for line in body.splitlines():
         self.failIf(len(line) > MAXBODYWIDTH)
     # attempts to decode the body, following the specified MIME endoding 
     # and charset
     try:
         if mime_decoder:
             body = mime_decoder.decodestring(body)
         body = unicode(body, charset)
     except Exception, e:
         raise AssertionError, e
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:28,代码来源:notification.py


示例3: test_date

 def test_date(self):
     """Date format compliance (RFC822) 
        we do not support 'military' format""" 
     date_str = r"^((?P<day>\w{3}),\s*)*(?P<dm>\d{2})\s+" \
                r"(?P<month>\w{3})\s+(?P<year>200\d)\s+" \
                r"(?P<hour>\d{2}):(?P<min>[0-5][0-9])" \
                r"(:(?P<sec>[0-5][0-9]))*\s" \
                r"((?P<tz>\w{2,3})|(?P<offset>[+\-]\d{4}))$"
     date_re = re.compile(date_str)
     # python time module does not detect incorrect time values
     days = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun']
     months = ['Jan','Feb','Mar','Apr','May','Jun', \
               'Jul','Aug','Sep','Oct','Nov','Dec']
     tz = ['UT','GMT','EST','EDT','CST','CDT','MST','MDT''PST','PDT']
     ticket = Ticket(self.env)
     ticket['reporter'] = '"Joe User" <[email protected]>'
     ticket['summary'] = 'This is a summary'
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     self.failIf('Date' not in headers)
     mo = date_re.match(headers['Date'])
     self.failIf(not mo)
     if mo.group('day'):
         self.failIf(mo.group('day') not in days)
     self.failIf(int(mo.group('dm')) not in range(1,32))
     self.failIf(mo.group('month') not in months)
     self.failIf(int(mo.group('hour')) not in range(0,24))
     if mo.group('tz'):
         self.failIf(mo.group('tz') not in tz)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:32,代码来源:notification.py


示例4: runTest

 def runTest(self):
     """User password resets notifies admin by mail"""
     self._tester.logout()
     self._smtpd.full_reset() # Clean all previous sent emails
     tc.notfind('Logout')
     # Goto Login
     tc.find("Login")
     tc.follow("Login")
     # Do we have the Forgot passwd link
     tc.find('Forgot your password?')
     tc.follow('Forgot your password?')
     
     username = "foo"
     email_addr = "[email protected]%s.tld" % self._testenv.port
     
     reset_form_name = 'acctmgr_passwd_reset'
     tc.formvalue(reset_form_name, 'username', username)
     tc.formvalue(reset_form_name, 'email', email_addr)
     tc.submit()
     
     headers, body = parse_smtp_message(
         self._smtpd.get_message('[email protected]%s.tld' % self._testenv.port))
     self.assertEqual(headers['Subject'],
                      '[%s] Password reset for user: %s' % (
                                         'testenv%s' % self._testenv.port,
                                         username))
     self.assertEqual(headers['X-URL'], self._testenv.url)
开发者ID:AshKash,项目名称:kit-sink,代码行数:27,代码来源:testcases.py


示例5: test_ignore_domains

 def test_ignore_domains(self):
     """Non-SMTP domain exclusion"""
     self.env.config.set("notification", "ignore_domains", "example.com, example.org")
     self.env.known_users = [
         ("[email protected]", "No Email", ""),
         ("[email protected]", "With Email", "[email protected]"),
     ]
     ticket = Ticket(self.env)
     ticket["reporter"] = "[email protected]"
     ticket["owner"] = "[email protected]"
     ticket["summary"] = "This is a summary"
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Msg should always have a 'To' field
     self.failIf("To" not in headers)
     tolist = [addr.strip() for addr in headers["To"].split(",")]
     # 'To' list should not contain addresses with non-SMTP domains
     self.failIf("[email protected]" in tolist)
     self.failIf("[email protected]" in tolist)
     # 'To' list should have been resolved to the actual email address
     self.failIf("[email protected]" not in tolist)
     self.failIf(len(tolist) != 1)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:25,代码来源:notification.py


示例6: _test_short_login

 def _test_short_login(enabled):
     ticket = Ticket(self.env)
     ticket['reporter'] = 'joeuser'
     ticket['summary'] = 'This is a summary'
     ticket.insert()
     # Be sure that at least one email address is valid, so that we 
     # send a notification even if other addresses are not valid
     self.env.config.set('notification', 'smtp_always_cc',
                         '[email protected]')
     if enabled:
         self.env.config.set('notification', 'use_short_addr', 'true')
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Msg should not have a 'To' header
     if not enabled:
         self.failIf('To' in headers)
     else:
         tolist = [addr.strip() for addr in headers['To'].split(',')]
     # Msg should have a 'Cc' field
     self.failIf('Cc' not in headers)
     cclist = [addr.strip() for addr in headers['Cc'].split(',')]
     if enabled:
         # Msg should be delivered to the reporter
         self.failIf(ticket['reporter'] not in tolist)
     else:
         # Msg should not be delivered to joeuser
         self.failIf(ticket['reporter'] in cclist)
     # Msg should still be delivered to the always_cc list
     self.failIf(self.env.config.get('notification',
                 'smtp_always_cc') not in cclist)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:32,代码来源:notification.py


示例7: test_email_map

 def test_email_map(self):
     """Login-to-email mapping"""
     self.env.config.set("notification", "always_notify_owner", "true")
     self.env.config.set("notification", "always_notify_reporter", "true")
     self.env.config.set("notification", "smtp_always_cc", "[email protected]")
     self.env.known_users = [
         ("joeuser", "Joe User", "[email protected]"),
         ("[email protected]", "Jim User", "[email protected]"),
     ]
     ticket = Ticket(self.env)
     ticket["reporter"] = "joeuser"
     ticket["owner"] = "[email protected]"
     ticket["summary"] = "This is a summary"
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Msg should always have a 'To' field
     self.failIf("To" not in headers)
     tolist = [addr.strip() for addr in headers["To"].split(",")]
     # 'To' list should have been resolved to the real email address
     self.failIf("[email protected]" not in tolist)
     self.failIf("[email protected]" not in tolist)
     self.failIf("joeuser" in tolist)
     self.failIf("[email protected]" in tolist)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:26,代码来源:notification.py


示例8: _test_updater

 def _test_updater(disable):
     if disable:
         self.env.config.set('notification','always_notify_updater',
                             'false')
     ticket = Ticket(self.env)
     ticket['reporter'] = '[email protected]'
     ticket['summary'] = u'This is a súmmäry'
     ticket['cc'] = '[email protected]'
     ticket.insert()
     ticket['component'] = 'dummy'
     now = time.time()
     ticket.save_changes('[email protected]', 'This is a change',
                         when=now)
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=False, modtime=now)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # checks for header existence
     self.failIf(not headers)
     # checks for updater in the 'To' recipient list
     self.failIf('To' not in headers)
     tolist = [addr.strip() for addr in headers['To'].split(',')]
     if disable:
         self.failIf('[email protected]' in tolist)
     else:
         self.failIf('[email protected]' not in tolist)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:26,代码来源:notification.py


示例9: _test_default_domain

 def _test_default_domain(enabled):
     self.env.config.set("notification", "always_notify_owner", "false")
     self.env.config.set("notification", "always_notify_reporter", "false")
     self.env.config.set("notification", "smtp_always_cc", "")
     ticket = Ticket(self.env)
     ticket["cc"] = "joenodom, [email protected]"
     ticket["summary"] = "This is a summary"
     ticket.insert()
     # Be sure that at least one email address is valid, so that we
     # send a notification even if other addresses are not valid
     self.env.config.set("notification", "smtp_always_cc", "[email protected]")
     if enabled:
         self.env.config.set("notification", "smtp_default_domain", "example.org")
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Msg should always have a 'Cc' field
     self.failIf("Cc" not in headers)
     cclist = [addr.strip() for addr in headers["Cc"].split(",")]
     self.failIf("[email protected]" not in cclist)
     self.failIf("[email protected]" not in cclist)
     if not enabled:
         self.failIf(len(cclist) != 2)
         self.failIf("joenodom" in cclist)
     else:
         self.failIf(len(cclist) != 3)
         self.failIf("[email protected]" not in cclist)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:28,代码来源:notification.py


示例10: _test_short_login

 def _test_short_login(enabled):
     ticket = Ticket(self.env)
     ticket["reporter"] = "joeuser"
     ticket["summary"] = "This is a summary"
     ticket.insert()
     # Be sure that at least one email address is valid, so that we
     # send a notification even if other addresses are not valid
     self.env.config.set("notification", "smtp_always_cc", "[email protected]")
     if enabled:
         self.env.config.set("notification", "use_short_addr", "true")
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Msg should not have a 'To' header
     if not enabled:
         self.failIf("To" in headers)
     else:
         tolist = [addr.strip() for addr in headers["To"].split(",")]
     # Msg should have a 'Cc' field
     self.failIf("Cc" not in headers)
     cclist = [addr.strip() for addr in headers["Cc"].split(",")]
     if enabled:
         # Msg should be delivered to the reporter
         self.failIf(ticket["reporter"] not in tolist)
     else:
         # Msg should not be delivered to joeuser
         self.failIf(ticket["reporter"] in cclist)
     # Msg should still be delivered to the always_cc list
     self.failIf(self.env.config.get("notification", "smtp_always_cc") not in cclist)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:30,代码来源:notification.py


示例11: test_date

 def test_date(self):
     """Date format compliance (RFC822) 
        we do not support 'military' format"""
     date_str = (
         r"^((?P<day>\w{3}),\s*)*(?P<dm>\d{2})\s+"
         r"(?P<month>\w{3})\s+(?P<year>\d{4})\s+"
         r"(?P<hour>\d{2}):(?P<min>[0-5][0-9])"
         r"(:(?P<sec>[0-5][0-9]))*\s"
         r"((?P<tz>\w{2,3})|(?P<offset>[+\-]\d{4}))$"
     )
     date_re = re.compile(date_str)
     # python time module does not detect incorrect time values
     days = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
     months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
     tz = ["UT", "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", "PDT"]
     ticket = Ticket(self.env)
     ticket["reporter"] = '"Joe User" <[email protected]>'
     ticket["summary"] = "This is a summary"
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     self.failIf("Date" not in headers)
     mo = date_re.match(headers["Date"])
     self.failIf(not mo)
     if mo.group("day"):
         self.failIf(mo.group("day") not in days)
     self.failIf(int(mo.group("dm")) not in range(1, 32))
     self.failIf(mo.group("month") not in months)
     self.failIf(int(mo.group("hour")) not in range(0, 24))
     if mo.group("tz"):
         self.failIf(mo.group("tz") not in tz)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:33,代码来源:notification.py


示例12: test_ignore_domains

 def test_ignore_domains(self):
     """Non-SMTP domain exclusion"""
     self.env.config.set('notification', 'ignore_domains',
                         'example.com, example.org')
     self.env.known_users = \
         [('[email protected]', 'No Email', ''), 
          ('[email protected]', 'With Email', '[email protected]')]
     ticket = Ticket(self.env)
     ticket['reporter'] = '[email protected]'
     ticket['owner'] = '[email protected]org'
     ticket['summary'] = 'This is a summary'
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Msg should always have a 'To' field
     self.failIf('To' not in headers)
     tolist = [addr.strip() for addr in headers['To'].split(',')]
     # 'To' list should not contain addresses with non-SMTP domains
     self.failIf('[email protected]' in tolist)
     self.failIf('[email protected]' in tolist)
     # 'To' list should have been resolved to the actual email address
     self.failIf('[email protected]' not in tolist)
     self.failIf(len(tolist) != 1)
开发者ID:gdgkyoto,项目名称:kyoto-gtug,代码行数:25,代码来源:notification.py


示例13: _test_default_domain

 def _test_default_domain(enabled):
     self.env.config.set('notification', 'always_notify_owner',
                         'false')
     self.env.config.set('notification', 'always_notify_reporter',
                         'false')
     self.env.config.set('notification', 'smtp_always_cc', '')
     ticket = Ticket(self.env)
     ticket['cc'] = 'joenodom, [email protected]'
     ticket['summary'] = 'This is a summary'
     ticket.insert()
     # Be sure that at least one email address is valid, so that we 
     # send a notification even if other addresses are not valid
     self.env.config.set('notification', 'smtp_always_cc',
                         '[email protected]')
     if enabled:
         self.env.config.set('notification', 'smtp_default_domain',
                             'example.org')
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Msg should always have a 'Cc' field
     self.failIf('Cc' not in headers)
     cclist = [addr.strip() for addr in headers['Cc'].split(',')]
     self.failIf('[email protected]' not in cclist)
     self.failIf('[email protected]' not in cclist)
     if not enabled:
         self.failIf(len(cclist) != 2)
         self.failIf('joenodom' in cclist)
     else:
         self.failIf(len(cclist) != 3)
         self.failIf('[email protected]' not in cclist)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:32,代码来源:notification.py


示例14: test_md5_digest

 def test_md5_digest(self):
     """MD5 digest w/ non-ASCII recipient address (#3491)"""
     self.env.config.set("notification", "always_notify_owner", "false")
     self.env.config.set("notification", "always_notify_reporter", "true")
     self.env.config.set("notification", "smtp_always_cc", "")
     ticket = Ticket(self.env)
     ticket["reporter"] = u'"Jöe Usèr" <[email protected]>'
     ticket["summary"] = u"This is a summary"
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:13,代码来源:notification.py


示例15: test_md5_digest

 def test_md5_digest(self):
     """MD5 digest w/ non-ASCII recipient address (#3491)"""
     self.env.config.set('notification', 'always_notify_owner', 'false')
     self.env.config.set('notification', 'always_notify_reporter', 'true')
     self.env.config.set('notification', 'smtp_always_cc', '')
     ticket = Ticket(self.env)
     ticket['reporter'] = u'"Jöe Usèr" <[email protected]>'
     ticket['summary'] = u'This is a summary'
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:13,代码来源:notification.py


示例16: test_multiline_header

 def test_multiline_header(self):
     """Encoded headers split into multiple lines"""
     self.env.config.set("notification", "mime_encoding", "qp")
     ticket = Ticket(self.env)
     ticket["reporter"] = "[email protected]"
     # Forces non-ascii characters
     ticket["summary"] = u"A_very %s súmmäry" % u" ".join(["long"] * 20)
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Discards the project name & ticket number
     subject = headers["Subject"]
     summary = subject[subject.find(":") + 2 :]
     self.failIf(ticket["summary"] != summary)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:16,代码来源:notification.py


示例17: test_multiline_header

 def test_multiline_header(self):
     """Encoded headers split into multiple lines"""
     self.env.config.set('notification','mime_encoding', 'qp')
     ticket = Ticket(self.env)
     ticket['reporter'] = '[email protected]'
     # Forces non-ascii characters
     ticket['summary'] = u'A_very %s súmmäry' % u' '.join(['long'] * 20)
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Discards the project name & ticket number
     subject = headers['Subject']
     summary = subject[subject.find(':')+2:]
     self.failIf(ticket['summary'] != summary)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:16,代码来源:notification.py


示例18: _validate_props_format

 def _validate_props_format(self, expected, ticket):
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     bodylines = body.splitlines()
     # Extract ticket properties
     delim_re = re.compile(r"^\-+\+\-+$")
     while not delim_re.match(bodylines[0]):
         bodylines.pop(0)
     lines = []
     for line in bodylines[1:]:
         if delim_re.match(line):
             break
         lines.append(line)
     self.assertEqual(expected, "\n".join(lines))
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:16,代码来源:notification.py


示例19: run_bcc_feature

 def run_bcc_feature(public):
     # CC list should be private
     self.env.config.set('notification', 'use_public_cc',
                         public and 'true' or 'false')
     self.env.config.set('notification', 'smtp_always_bcc', 
                         '[email protected]')
     ticket = Ticket(self.env)
     ticket['reporter'] = '"Joe User" <[email protected]>'
     ticket['summary'] = 'This is a summary'
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     if public:
         # Msg should have a To list
         self.failIf('To' not in headers)
         # Extract the list of 'To' recipients from the message
         to = [rcpt.strip() for rcpt in headers['To'].split(',')]
     else:
         # Msg should not have a To list
         self.failIf('To' in headers)
         # Extract the list of 'To' recipients from the message
         to = []            
     # Extract the list of 'Cc' recipients from the message
     cc = [rcpt.strip() for rcpt in headers['Cc'].split(',')]
     # Extract the list of the actual SMTP recipients
     rcptlist = notifysuite.smtpd.get_recipients()
     # Build the list of the expected 'Cc' recipients 
     ccrcpt = self.env.config.get('notification', 'smtp_always_cc')
     cclist = [ccr.strip() for ccr in ccrcpt.split(',')]
     for rcpt in cclist:
         # Each recipient of the 'Cc' list should appear 
         # in the 'Cc' header
         self.failIf(rcpt not in cc)
         # Check the message has actually been sent to the recipients
         self.failIf(rcpt not in rcptlist)
     # Build the list of the expected 'Bcc' recipients 
     bccrcpt = self.env.config.get('notification', 'smtp_always_bcc')
     bcclist = [bccr.strip() for bccr in bccrcpt.split(',')]
     for rcpt in bcclist:
         # Check none of the 'Bcc' recipients appears 
         # in the 'To' header
         self.failIf(rcpt in to)
         # Check the message has actually been sent to the recipients
         self.failIf(rcpt not in rcptlist)
开发者ID:cyphactor,项目名称:lifecyclemanager,代码行数:46,代码来源:notification.py


示例20: test_admit_domains

 def test_admit_domains(self):
     """SMTP domain inclusion"""
     self.env.config.set("notification", "admit_domains", "localdomain, server")
     ticket = Ticket(self.env)
     ticket["reporter"] = "[email protected]"
     ticket["summary"] = "This is a summary"
     ticket["cc"] = "[email protected], [email protected], " "[email protected]"
     ticket.insert()
     tn = TicketNotifyEmail(self.env)
     tn.notify(ticket, newticket=True)
     message = notifysuite.smtpd.get_message()
     (headers, body) = parse_smtp_message(message)
     # Msg should always have a 'To' field
     self.failIf("Cc" not in headers)
     cclist = [addr.strip() for addr in headers["Cc"].split(",")]
     # 'Cc' list should contain addresses with SMTP included domains
     self.failIf("[email protected]" not in cclist)
     self.failIf("[email protected]" not in cclist)
     # 'Cc' list should not contain non-FQDN domains
     self.failIf("[email protected]" in cclist)
     self.failIf(len(cclist) != 2 + 2)
开发者ID:moreati,项目名称:trac-gitsvn,代码行数:21,代码来源:notification.py



注:本文中的trac.tests.notification.parse_smtp_message函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ticket.Milestone类代码示例发布时间:2022-05-27
下一篇:
Python tc.url函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap