Python mailbox.MMDFMessage() Examples
The following are 30
code examples of mailbox.MMDFMessage().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
mailbox
, or try the search function
.
Example #1
Source File: test_mailbox.py From ironpython3 with Apache License 2.0 | 6 votes |
def test_babyl_to_mboxmmdf(self): # Convert BabylMessage to mboxMessage and MMDFMessage pairs = (('unseen', 'O'), ('deleted', 'ROD'), ('filed', 'RO'), ('answered', 'ROA'), ('forwarded', 'RO'), ('edited', 'RO'), ('resent', 'RO')) for setting, result in pairs: for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg = mailbox.BabylMessage(_sample_message) msg.add_label(setting) self.assertEqual(class_(msg).get_flags(), result) msg = mailbox.BabylMessage(_sample_message) for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded', 'edited', 'resent'): msg.add_label(label) for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): self.assertEqual(class_(msg).get_flags(), 'ODA')
Example #2
Source File: test_mailbox.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
def test_babyl_to_mboxmmdf(self): # Convert BabylMessage to mboxMessage and MMDFMessage pairs = (('unseen', 'O'), ('deleted', 'ROD'), ('filed', 'RO'), ('answered', 'ROA'), ('forwarded', 'RO'), ('edited', 'RO'), ('resent', 'RO')) for setting, result in pairs: for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg = mailbox.BabylMessage(_sample_message) msg.add_label(setting) self.assertEqual(class_(msg).get_flags(), result) msg = mailbox.BabylMessage(_sample_message) for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded', 'edited', 'resent'): msg.add_label(label) for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): self.assertEqual(class_(msg).get_flags(), 'ODA')
Example #3
Source File: test_mailbox.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
def test_babyl_to_mboxmmdf(self): # Convert BabylMessage to mboxMessage and MMDFMessage pairs = (('unseen', 'O'), ('deleted', 'ROD'), ('filed', 'RO'), ('answered', 'ROA'), ('forwarded', 'RO'), ('edited', 'RO'), ('resent', 'RO')) for setting, result in pairs: for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg = mailbox.BabylMessage(_sample_message) msg.add_label(setting) self.assertEqual(class_(msg).get_flags(), result) msg = mailbox.BabylMessage(_sample_message) for label in ('unseen', 'deleted', 'filed', 'answered', 'forwarded', 'edited', 'resent'): msg.add_label(label) for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): self.assertEqual(class_(msg).get_flags(), 'ODA')
Example #4
Source File: test_mailbox.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_add_mbox_or_mmdf_message(self): # Add an mboxMessage or MMDFMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg = class_('From foo@bar blah\nFrom: foo\n\n0\n') key = self._box.add(msg)
Example #5
Source File: test_mailbox.py From medicare-demo with Apache License 2.0 | 5 votes |
def test_mh_to_mboxmmdf(self): # Convert MHMessage to mboxMessage and MMDFMessage pairs = (('unseen', 'O'), ('replied', 'ROA'), ('flagged', 'ROF')) for setting, result in pairs: msg = mailbox.MHMessage(_sample_message) msg.add_sequence(setting) for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): self.assert_(class_(msg).get_flags() == result) msg = mailbox.MHMessage(_sample_message) msg.add_sequence('unseen') msg.add_sequence('replied') msg.add_sequence('flagged') for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): self.assert_(class_(msg).get_flags() == 'OFA')
Example #6
Source File: test_mailbox.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_mboxmmdf_to_mh(self): # Convert mboxMessage and MMDFMessage to MHMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg_mboxMMDF = class_(_sample_message) pairs = (('R', []), ('O', ['unseen']), ('D', ['unseen']), ('F', ['unseen', 'flagged']), ('A', ['unseen', 'replied']), ('RODFA', ['replied', 'flagged'])) for setting, result in pairs: msg_mboxMMDF.set_flags(setting) self.assertEqual(mailbox.MHMessage(msg_mboxMMDF).get_sequences(), result)
Example #7
Source File: test_mailbox.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_mboxmmdf_to_babyl(self): # Convert mboxMessage and MMDFMessage to BabylMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg = class_(_sample_message) pairs = (('R', []), ('O', ['unseen']), ('D', ['unseen', 'deleted']), ('F', ['unseen']), ('A', ['unseen', 'answered']), ('RODFA', ['deleted', 'answered'])) for setting, result in pairs: msg.set_flags(setting) self.assertEqual(mailbox.BabylMessage(msg).get_labels(), result)
Example #8
Source File: test_mailbox.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_mboxmmdf_to_mboxmmdf(self): # Convert mboxMessage and MMDFMessage to mboxMessage and MMDFMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg_mboxMMDF = class_(_sample_message) msg_mboxMMDF.set_flags('RODFA') msg_mboxMMDF.set_from('foo@bar') for class2_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg2 = class2_(msg_mboxMMDF) self.assertEqual(msg2.get_flags(), 'RODFA') self.assertEqual(msg2.get_from(), 'foo@bar')
Example #9
Source File: test_mailbox.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_x_to_plain(self): # Convert all formats to Message for class_ in (mailbox.Message, mailbox.MaildirMessage, mailbox.mboxMessage, mailbox.MHMessage, mailbox.BabylMessage, mailbox.MMDFMessage): msg = class_(_sample_message) msg_plain = mailbox.Message(msg) self._check_sample(msg_plain)
Example #10
Source File: test_mailbox.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_plain_to_x(self): # Convert Message to all formats for class_ in (mailbox.Message, mailbox.MaildirMessage, mailbox.mboxMessage, mailbox.MHMessage, mailbox.BabylMessage, mailbox.MMDFMessage): msg_plain = mailbox.Message(_sample_message) msg = class_(msg_plain) self._check_sample(msg)
Example #11
Source File: test_mailbox.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_explain_to(self): # Copy self's format-specific data to other message formats. # This test is superficial; better ones are in TestMessageConversion. msg = self._factory() for class_ in (mailbox.Message, mailbox.MaildirMessage, mailbox.mboxMessage, mailbox.MHMessage, mailbox.BabylMessage, mailbox.MMDFMessage): other_msg = class_() msg._explain_to(other_msg) other_msg = email.message.Message() self.assertRaises(TypeError, lambda: msg._explain_to(other_msg))
Example #12
Source File: test_mailbox.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_add_mbox_or_mmdf_message(self): # Add an mboxMessage or MMDFMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg = class_('From foo@bar blah\nFrom: foo\n\n0\n') key = self._box.add(msg)
Example #13
Source File: test_mailbox.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_x_to_invalid(self): # Convert all formats to an invalid format for class_ in (mailbox.Message, mailbox.MaildirMessage, mailbox.mboxMessage, mailbox.MHMessage, mailbox.BabylMessage, mailbox.MMDFMessage): self.assertRaises(TypeError, lambda: class_(False))
Example #14
Source File: test_mailbox.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_mboxmmdf_to_mh(self): # Convert mboxMessage and MMDFMessage to MHMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg_mboxMMDF = class_(_sample_message) pairs = (('R', []), ('O', ['unseen']), ('D', ['unseen']), ('F', ['unseen', 'flagged']), ('A', ['unseen', 'replied']), ('RODFA', ['replied', 'flagged'])) for setting, result in pairs: msg_mboxMMDF.set_flags(setting) self.assertEqual(mailbox.MHMessage(msg_mboxMMDF).get_sequences(), result)
Example #15
Source File: test_mailbox.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_mboxmmdf_to_mboxmmdf(self): # Convert mboxMessage and MMDFMessage to mboxMessage and MMDFMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg_mboxMMDF = class_(_sample_message) msg_mboxMMDF.set_flags('RODFA') msg_mboxMMDF.set_from('foo@bar') for class2_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg2 = class2_(msg_mboxMMDF) self.assertEqual(msg2.get_flags(), 'RODFA') self.assertEqual(msg2.get_from(), 'foo@bar')
Example #16
Source File: test_mailbox.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_mboxmmdf_to_maildir(self): # Convert mboxMessage and MMDFMessage to MaildirMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg_mboxMMDF = class_(_sample_message) msg_mboxMMDF.set_from('foo@bar', time.gmtime(0.0)) pairs = (('R', 'S'), ('O', ''), ('D', 'T'), ('F', 'F'), ('A', 'R'), ('RODFA', 'FRST')) for setting, result in pairs: msg_mboxMMDF.set_flags(setting) msg = mailbox.MaildirMessage(msg_mboxMMDF) self.assertEqual(msg.get_flags(), result) self.assertEqual(msg.get_date(), 0.0) msg_mboxMMDF.set_flags('O') self.assertEqual(mailbox.MaildirMessage(msg_mboxMMDF).get_subdir(), 'cur')
Example #17
Source File: test_mailbox.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def test_maildir_to_mboxmmdf(self): # Convert MaildirMessage to mboxmessage and MMDFMessage pairs = (('D', ''), ('F', 'F'), ('P', ''), ('R', 'A'), ('S', 'R'), ('T', 'D'), ('DFPRST', 'RDFA')) for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg_maildir = mailbox.MaildirMessage(_sample_message) msg_maildir.set_date(0.0) for setting, result in pairs: msg_maildir.set_flags(setting) msg = class_(msg_maildir) self.assertEqual(msg.get_flags(), result) self.assertEqual(msg.get_from(), 'MAILER-DAEMON %s' % time.asctime(time.gmtime(0.0))) msg_maildir.set_subdir('cur') self.assertEqual(class_(msg_maildir).get_flags(), 'RODFA')
Example #18
Source File: test_mailbox.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_mboxmmdf_to_mh(self): # Convert mboxMessage and MMDFMessage to MHMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg_mboxMMDF = class_(_sample_message) pairs = (('R', []), ('O', ['unseen']), ('D', ['unseen']), ('F', ['unseen', 'flagged']), ('A', ['unseen', 'replied']), ('RODFA', ['replied', 'flagged'])) for setting, result in pairs: msg_mboxMMDF.set_flags(setting) self.assertEqual(mailbox.MHMessage(msg_mboxMMDF).get_sequences(), result)
Example #19
Source File: test_mailbox.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_mh_to_mboxmmdf(self): # Convert MHMessage to mboxMessage and MMDFMessage pairs = (('unseen', 'O'), ('replied', 'ROA'), ('flagged', 'ROF')) for setting, result in pairs: msg = mailbox.MHMessage(_sample_message) msg.add_sequence(setting) for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): self.assertEqual(class_(msg).get_flags(), result) msg = mailbox.MHMessage(_sample_message) msg.add_sequence('unseen') msg.add_sequence('replied') msg.add_sequence('flagged') for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): self.assertEqual(class_(msg).get_flags(), 'OFA')
Example #20
Source File: test_mailbox.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_mboxmmdf_to_babyl(self): # Convert mboxMessage and MMDFMessage to BabylMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg = class_(_sample_message) pairs = (('R', []), ('O', ['unseen']), ('D', ['unseen', 'deleted']), ('F', ['unseen']), ('A', ['unseen', 'answered']), ('RODFA', ['deleted', 'answered'])) for setting, result in pairs: msg.set_flags(setting) self.assertEqual(mailbox.BabylMessage(msg).get_labels(), result)
Example #21
Source File: test_mailbox.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_mboxmmdf_to_mh(self): # Convert mboxMessage and MMDFMessage to MHMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg_mboxMMDF = class_(_sample_message) pairs = (('R', []), ('O', ['unseen']), ('D', ['unseen']), ('F', ['unseen', 'flagged']), ('A', ['unseen', 'replied']), ('RODFA', ['replied', 'flagged'])) for setting, result in pairs: msg_mboxMMDF.set_flags(setting) self.assertEqual(mailbox.MHMessage(msg_mboxMMDF).get_sequences(), result)
Example #22
Source File: test_mailbox.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_mboxmmdf_to_mboxmmdf(self): # Convert mboxMessage and MMDFMessage to mboxMessage and MMDFMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg_mboxMMDF = class_(_sample_message) msg_mboxMMDF.set_flags('RODFA') msg_mboxMMDF.set_from('foo@bar') for class2_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg2 = class2_(msg_mboxMMDF) self.assertEqual(msg2.get_flags(), 'RODFA') self.assertEqual(msg2.get_from(), 'foo@bar')
Example #23
Source File: test_mailbox.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_mboxmmdf_to_maildir(self): # Convert mboxMessage and MMDFMessage to MaildirMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg_mboxMMDF = class_(_sample_message) msg_mboxMMDF.set_from('foo@bar', time.gmtime(0.0)) pairs = (('R', 'S'), ('O', ''), ('D', 'T'), ('F', 'F'), ('A', 'R'), ('RODFA', 'FRST')) for setting, result in pairs: msg_mboxMMDF.set_flags(setting) msg = mailbox.MaildirMessage(msg_mboxMMDF) self.assertEqual(msg.get_flags(), result) self.assertEqual(msg.get_date(), 0.0) msg_mboxMMDF.set_flags('O') self.assertEqual(mailbox.MaildirMessage(msg_mboxMMDF).get_subdir(), 'cur')
Example #24
Source File: test_mailbox.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_x_to_invalid(self): # Convert all formats to an invalid format for class_ in (mailbox.Message, mailbox.MaildirMessage, mailbox.mboxMessage, mailbox.MHMessage, mailbox.BabylMessage, mailbox.MMDFMessage): self.assertRaises(TypeError, lambda: class_(False))
Example #25
Source File: test_mailbox.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_x_to_plain(self): # Convert all formats to Message for class_ in (mailbox.Message, mailbox.MaildirMessage, mailbox.mboxMessage, mailbox.MHMessage, mailbox.BabylMessage, mailbox.MMDFMessage): msg = class_(_sample_message) msg_plain = mailbox.Message(msg) self._check_sample(msg_plain)
Example #26
Source File: test_mailbox.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_plain_to_x(self): # Convert Message to all formats for class_ in (mailbox.Message, mailbox.MaildirMessage, mailbox.mboxMessage, mailbox.MHMessage, mailbox.BabylMessage, mailbox.MMDFMessage): msg_plain = mailbox.Message(_sample_message) msg = class_(msg_plain) self._check_sample(msg)
Example #27
Source File: test_mailbox.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_explain_to(self): # Copy self's format-specific data to other message formats. # This test is superficial; better ones are in TestMessageConversion. msg = self._factory() for class_ in (mailbox.Message, mailbox.MaildirMessage, mailbox.mboxMessage, mailbox.MHMessage, mailbox.BabylMessage, mailbox.MMDFMessage): other_msg = class_() msg._explain_to(other_msg) other_msg = email.message.Message() self.assertRaises(TypeError, lambda: msg._explain_to(other_msg))
Example #28
Source File: test_mailbox.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_add_mbox_or_mmdf_message(self): # Add an mboxMessage or MMDFMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg = class_('From foo@bar blah\nFrom: foo\n\n0\n') key = self._box.add(msg)
Example #29
Source File: test_mailbox.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_mh_to_mboxmmdf(self): # Convert MHMessage to mboxMessage and MMDFMessage pairs = (('unseen', 'O'), ('replied', 'ROA'), ('flagged', 'ROF')) for setting, result in pairs: msg = mailbox.MHMessage(_sample_message) msg.add_sequence(setting) for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): self.assertEqual(class_(msg).get_flags(), result) msg = mailbox.MHMessage(_sample_message) msg.add_sequence('unseen') msg.add_sequence('replied') msg.add_sequence('flagged') for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): self.assertEqual(class_(msg).get_flags(), 'OFA')
Example #30
Source File: test_mailbox.py From ironpython3 with Apache License 2.0 | 5 votes |
def test_mboxmmdf_to_mboxmmdf(self): # Convert mboxMessage and MMDFMessage to mboxMessage and MMDFMessage for class_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg_mboxMMDF = class_(_sample_message) msg_mboxMMDF.set_flags('RODFA') msg_mboxMMDF.set_from('foo@bar') for class2_ in (mailbox.mboxMessage, mailbox.MMDFMessage): msg2 = class2_(msg_mboxMMDF) self.assertEqual(msg2.get_flags(), 'RODFA') self.assertEqual(msg2.get_from(), 'foo@bar')