mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-17 12:06:55 +01:00
Enhancement: use friendly file names when emailing documents (#11055)
This commit is contained in:
parent
39c429bb87
commit
340754d865
5 changed files with 142 additions and 29 deletions
|
|
@ -3022,7 +3022,8 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
|||
)
|
||||
|
||||
self.assertEqual(len(mail.outbox), 1)
|
||||
self.assertEqual(mail.outbox[0].attachments[0][0], "archive.pdf")
|
||||
expected_filename = f"{doc.created} test.pdf"
|
||||
self.assertEqual(mail.outbox[0].attachments[0][0], expected_filename)
|
||||
|
||||
self.client.post(
|
||||
f"/api/documents/{doc2.pk}/email/",
|
||||
|
|
@ -3035,7 +3036,8 @@ class TestDocumentApi(DirectoriesMixin, DocumentConsumeDelayMixin, APITestCase):
|
|||
)
|
||||
|
||||
self.assertEqual(len(mail.outbox), 2)
|
||||
self.assertEqual(mail.outbox[1].attachments[0][0], "test2.pdf")
|
||||
expected_filename2 = f"{doc2.created} test2.pdf"
|
||||
self.assertEqual(mail.outbox[1].attachments[0][0], expected_filename2)
|
||||
|
||||
@mock.patch("django.core.mail.message.EmailMessage.send", side_effect=Exception)
|
||||
def test_email_document_errors(self, mocked_send):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue