Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Attributes
test.test_mailbox.MaildirTestCase Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def createMessage
def test_empty_maildir
def test_nonempty_maildir_cur
def test_nonempty_maildir_new
def test_nonempty_maildir_both

Public Attributes

 mbox

Private Attributes

 _dir
 _counter
 _msgfiles

Detailed Description

Definition at line 1991 of file test_mailbox.py.


Member Function Documentation

def test.test_mailbox.MaildirTestCase.createMessage (   self,
  dir,
  mbox = False 
)

Definition at line 2010 of file test_mailbox.py.

02010 
02011     def createMessage(self, dir, mbox=False):
02012         t = int(time.time() % 1000000)
02013         pid = self._counter
02014         self._counter += 1
02015         filename = ".".join((str(t), str(pid), "myhostname", "mydomain"))
02016         tmpname = os.path.join(self._dir, "tmp", filename)
02017         newname = os.path.join(self._dir, dir, filename)
02018         with open(tmpname, "w") as fp:
02019             self._msgfiles.append(tmpname)
02020             if mbox:
02021                 fp.write(FROM_)
02022             fp.write(DUMMY_MESSAGE)
02023         if hasattr(os, "link"):
02024             os.link(tmpname, newname)
02025         else:
02026             with open(newname, "w") as fp:
02027                 fp.write(DUMMY_MESSAGE)
02028         self._msgfiles.append(newname)
02029         return tmpname

Here is the caller graph for this function:

Definition at line 1993 of file test_mailbox.py.

01993 
01994     def setUp(self):
01995         # create a new maildir mailbox to work with:
01996         self._dir = support.TESTFN
01997         os.mkdir(self._dir)
01998         os.mkdir(os.path.join(self._dir, "cur"))
01999         os.mkdir(os.path.join(self._dir, "tmp"))
02000         os.mkdir(os.path.join(self._dir, "new"))
02001         self._counter = 1
02002         self._msgfiles = []

Here is the caller graph for this function:

Definition at line 2003 of file test_mailbox.py.

02003 
02004     def tearDown(self):
02005         list(map(os.unlink, self._msgfiles))
02006         os.rmdir(os.path.join(self._dir, "cur"))
02007         os.rmdir(os.path.join(self._dir, "tmp"))
02008         os.rmdir(os.path.join(self._dir, "new"))
02009         os.rmdir(self._dir)

Here is the caller graph for this function:

Test an empty maildir mailbox

Definition at line 2030 of file test_mailbox.py.

02030 
02031     def test_empty_maildir(self):
02032         """Test an empty maildir mailbox"""
02033         # Test for regression on bug #117490:
02034         # Make sure the boxes attribute actually gets set.
02035         self.mbox = mailbox.Maildir(support.TESTFN)
02036         #self.assertTrue(hasattr(self.mbox, "boxes"))
02037         #self.assertEqual(len(self.mbox.boxes), 0)
02038         self.assertIs(self.mbox.next(), None)
02039         self.assertIs(self.mbox.next(), None)

Definition at line 2056 of file test_mailbox.py.

02056 
02057     def test_nonempty_maildir_both(self):
02058         self.createMessage("cur")
02059         self.createMessage("new")
02060         self.mbox = mailbox.Maildir(support.TESTFN)
02061         #self.assertEqual(len(self.mbox.boxes), 2)
02062         self.assertIsNot(self.mbox.next(), None)
02063         self.assertIsNot(self.mbox.next(), None)
02064         self.assertIs(self.mbox.next(), None)
02065         self.assertIs(self.mbox.next(), None)

Here is the call graph for this function:

Definition at line 2040 of file test_mailbox.py.

02040 
02041     def test_nonempty_maildir_cur(self):
02042         self.createMessage("cur")
02043         self.mbox = mailbox.Maildir(support.TESTFN)
02044         #self.assertEqual(len(self.mbox.boxes), 1)
02045         self.assertIsNot(self.mbox.next(), None)
02046         self.assertIs(self.mbox.next(), None)
02047         self.assertIs(self.mbox.next(), None)

Here is the call graph for this function:

Definition at line 2048 of file test_mailbox.py.

02048 
02049     def test_nonempty_maildir_new(self):
02050         self.createMessage("new")
02051         self.mbox = mailbox.Maildir(support.TESTFN)
02052         #self.assertEqual(len(self.mbox.boxes), 1)
02053         self.assertIsNot(self.mbox.next(), None)
02054         self.assertIs(self.mbox.next(), None)
02055         self.assertIs(self.mbox.next(), None)

Here is the call graph for this function:


Member Data Documentation

Definition at line 2000 of file test_mailbox.py.

Definition at line 1995 of file test_mailbox.py.

Definition at line 2001 of file test_mailbox.py.

Definition at line 2034 of file test_mailbox.py.


The documentation for this class was generated from the following file: