def test_list_subfolder_contents(self): """list_folder returns the contents of a non INBOX folder""" mailpath = self.write_mail(".INBOX.subdir", "cur", "0000:2") result = maildir.list_folder(self.root, "INBOX.subdir") self.assertEqual(list(result), [mailpath])
def test_list_folder_move_new(self): """list_folder moves mail out of new into cur""" cur_path = os.path.join(self.root, "cur") expectpath = os.path.join(cur_path, "0000:2,") path = self.write_mail("new", "0000") result = maildir.list_folder(self.root, "INBOX") self.assertEqual(list(result), [expectpath]) self.assertFalse(os.path.exists(path))
def test_list_folder_mismatch(self): """list_folder correctly matches with_flags with no matches""" path = self.write_mail("cur", "0000:2,") pathS = self.write_mail("cur", "0000:2,S") pathP = self.write_mail("cur", "0000:2,P") pathPS = self.write_mail("cur", "0000:2,PS") result = list(maildir.list_folder(self.root, "INBOX", with_flags="D")) self.assertNotIn(path, result) self.assertNotIn(pathS, result) self.assertNotIn(pathP, result) self.assertNotIn(pathPS, result)
def test_list_folder_without_empty(self): """list_folder correctly matches with empty without_flags""" path = self.write_mail("cur", "0000:2,") pathS = self.write_mail("cur", "0000:2,S") pathP = self.write_mail("cur", "0000:2,P") pathPS = self.write_mail("cur", "0000:2,PS") result = list(maildir.list_folder(self.root, "INBOX", without_flags="")) self.assertIn(path, result) self.assertIn(pathS, result) self.assertIn(pathP, result) self.assertIn(pathPS, result)
def test_list_folder_contents(self): """list_folder returns the contents of a non empty folder""" expected = self.write_mail("cur", "0000:2") result = maildir.list_folder(self.root, "INBOX") self.assertEqual(list(result), [expected])
def test_list_folder_empty(self): """list_folder yields nothing for an empty folder""" result = maildir.list_folder(self.root, "INBOX") self.assertEquals(list(result), [])