コード例 #1
0
 def test_original_to_in_body(self):
     header_to = "*****@*****.**"
     original_to = "*****@*****.**"
     alias = "librarian-somewhere"
     body = "%s: %s\n\nsome body stuff" % (ORIGINAL_TO_HEADER, original_to)
     log = BufferLogger()
     mail = self.factory.makeSignedMessage(body=body, to_address=header_to)
     addresses = extract_addresses(mail, alias, log)
     self.assertThat(addresses, Equals([header_to]))
     self.assertThat(log.getLogBuffer(), Equals("INFO Suspected spam: librarian-somewhere\n"))
コード例 #2
0
 def test_original_to_missing(self):
     header_to = '*****@*****.**'
     alias = 'librarian-somewhere'
     log = BufferLogger()
     mail = self.factory.makeSignedMessage(to_address=header_to)
     addresses = extract_addresses(mail, alias, log)
     self.assertThat(addresses, Equals([header_to]))
     self.assertThat(
         log.getLogBuffer(),
         Equals('WARNING No X-Launchpad-Original-To header was present '
                'in email: librarian-somewhere\n'))
コード例 #3
0
 def test_original_to_in_body(self):
     header_to = '*****@*****.**'
     original_to = '*****@*****.**'
     alias = 'librarian-somewhere'
     body = '%s: %s\n\nsome body stuff' % (ORIGINAL_TO_HEADER, original_to)
     log = BufferLogger()
     mail = self.factory.makeSignedMessage(body=body, to_address=header_to)
     addresses = extract_addresses(mail, alias, log)
     self.assertThat(addresses, Equals([header_to]))
     self.assertThat(log.getLogBuffer(),
                     Equals('INFO Suspected spam: librarian-somewhere\n'))
コード例 #4
0
 def test_original_to_missing(self):
     header_to = "*****@*****.**"
     alias = "librarian-somewhere"
     log = BufferLogger()
     mail = self.factory.makeSignedMessage(to_address=header_to)
     addresses = extract_addresses(mail, alias, log)
     self.assertThat(addresses, Equals([header_to]))
     self.assertThat(
         log.getLogBuffer(),
         Equals("WARNING No X-Launchpad-Original-To header was present " "in email: librarian-somewhere\n"),
     )
コード例 #5
0
 def test_original_to(self):
     mail = self.factory.makeSignedMessage()
     original_to = '*****@*****.**'
     mail[ORIGINAL_TO_HEADER] = original_to
     self.assertThat(extract_addresses(mail, None, None),
                     Equals([original_to]))
コード例 #6
0
 def test_original_to(self):
     mail = self.factory.makeSignedMessage()
     original_to = "*****@*****.**"
     mail[ORIGINAL_TO_HEADER] = original_to
     self.assertThat(extract_addresses(mail, None, None), Equals([original_to]))