Beispiel #1
0
    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])
Beispiel #2
0
    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))
Beispiel #3
0
    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)
Beispiel #4
0
    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)
Beispiel #5
0
    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])
Beispiel #6
0
    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), [])