コード例 #1
0
 def test_delete(self):
     # Deleting the item removes the file from the mail dir.
     self._add_mailfile('foo', 'This is the content')
     self._add_mailfile('bar', 'More content')
     box = DirectoryMailBox(self.email_dir)
     box.delete(os.path.join(self.email_dir, 'foo'))
     items = list(box.items())
     self.assertEqual(1, len(items))
コード例 #2
0
 def test_deleting_while_iterating(self):
     # Deleting while iterating through should be fine.
     self._add_mailfile('foo', 'This is the content')
     self._add_mailfile('bar', 'More content')
     self._add_mailfile('baz', 'More content')
     box = DirectoryMailBox(self.email_dir)
     for id, content in box.items():
         box.delete(id)
     self.assertEqual(0, len(list(box.items())))