summaryrefslogtreecommitdiff
path: root/Lib/test/test_mailbox.py
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2008-01-19 20:12:04 +0000
committerAndrew M. Kuchling <amk@amk.ca>2008-01-19 20:12:04 +0000
commit15ce880cc8c3de29e91e2e867b2db0b19a48e5f3 (patch)
treee1ad90f90c0a1d6d69b207423eabdfc7d25fde75 /Lib/test/test_mailbox.py
parentc6fde7293e57f16affb068f60b1998114e041b91 (diff)
downloadcpython-git-15ce880cc8c3de29e91e2e867b2db0b19a48e5f3.tar.gz
Bug 1277: make Maildir use the user-provided factory instead of hard-wiring MaildirMessage.
2.5.2 bugfix candidate.
Diffstat (limited to 'Lib/test/test_mailbox.py')
-rw-r--r--Lib/test/test_mailbox.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
index 684aeb21c3..ff214cef98 100644
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -509,6 +509,20 @@ class TestMaildir(TestMailbox):
self.assert_(msg_returned.get_flags() == 'S')
self.assert_(msg_returned.get_payload() == '3')
+ def test_consistent_factory(self):
+ # Add a message.
+ msg = mailbox.MaildirMessage(self._template % 0)
+ msg.set_subdir('cur')
+ msg.set_flags('RF')
+ key = self._box.add(msg)
+
+ # Create new mailbox with
+ class FakeMessage(mailbox.MaildirMessage):
+ pass
+ box = mailbox.Maildir(self._path, factory=FakeMessage)
+ msg2 = box.get_message(key)
+ self.assert_(isinstance(msg2, FakeMessage))
+
def test_initialize_new(self):
# Initialize a non-existent mailbox
self.tearDown()