A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
mail tests
jonaswinklere1e11de2b546
diff --git a/src/paperless_mail/tests/test_mail.py b/src/paperless_mail/tests/test_mail.pyindex 0104f5023..bec0ff4b4 100644--- a/src/paperless_mail/tests/test_mail.py+++ b/src/paperless_mail/tests/test_mail.py@@ -1,3 +1,4 @@+import osimport uuidfrom collections import namedtuplefrom typing import ContextManager@@ -9,6 +10,7 @@ from django.test import TestCasefrom imap_tools import MailMessageFlags, MailboxFolderSelectErrorfrom documents.models import Correspondent+from documents.tests.utils import DirectoriesMixinfrom paperless_mail import tasksfrom paperless_mail.mail import MailError, MailAccountHandlerfrom paperless_mail.models import MailRule, MailAccount@@ -130,7 +132,7 @@ def fake_magic_from_buffer(buffer, mime=False):@mock.patch('paperless_mail.mail.magic.from_buffer', fake_magic_from_buffer)-class TestMail(TestCase):+class TestMail(DirectoriesMixin, TestCase):def setUp(self):patcher = mock.patch('paperless_mail.mail.MailBox')@@ -146,6 +148,7 @@ class TestMail(TestCase):self.reset_bogus_mailbox()self.mail_account_handler = MailAccountHandler()+ super(TestMail, self).setUp()def reset_bogus_mailbox(self):self.bogus_mailbox.messages = []@@ -220,9 +223,13 @@ class TestMail(TestCase):args1, kwargs1 = self.async_task.call_args_list[0]args2, kwargs2 = self.async_task.call_args_list[1]+ self.assertTrue(os.path.isfile(kwargs1['path']), kwargs1['path'])+self.assertEqual(kwargs1['override_title'], "file_0")self.assertEqual(kwargs1['override_filename'], "file_0.pdf")+ self.assertTrue(os.path.isfile(kwargs2['path']), kwargs1['path'])+self.assertEqual(kwargs2['override_title'], "file_1")self.assertEqual(kwargs2['override_filename'], "file_1.pdf")@@ -253,6 +260,7 @@ class TestMail(TestCase):self.assertEqual(self.async_task.call_count, 1)args, kwargs = self.async_task.call_args+ self.assertTrue(os.path.isfile(kwargs['path']), kwargs['path'])self.assertEqual(kwargs['override_filename'], "f1.pdf")def test_handle_disposition(self):