From 9320df02683f084a4af01c2dc03c38bdd4d5a502 Mon Sep 17 00:00:00 2001 From: Benbb96 Date: Thu, 14 Apr 2022 23:30:42 +0200 Subject: [PATCH] Fix a bug I introduced in earlier commit + fix one test --- helpdesk/lib.py | 2 +- helpdesk/tests/test_attachments.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/helpdesk/lib.py b/helpdesk/lib.py index 05e80dfd..f9adb174 100644 --- a/helpdesk/lib.py +++ b/helpdesk/lib.py @@ -136,7 +136,7 @@ def process_attachments(followup, attached_files): if attached.size: filename = smart_text(attached.name) - att = followup.followupattachment_set( + att = followup.followupattachment_set.create( file=attached, filename=filename, mime_type=attached.content_type or diff --git a/helpdesk/tests/test_attachments.py b/helpdesk/tests/test_attachments.py index 942a2353..82983e68 100644 --- a/helpdesk/tests/test_attachments.py +++ b/helpdesk/tests/test_attachments.py @@ -147,7 +147,7 @@ class AttachmentUnitTests(TestCase): self.assertEqual(obj.size, len(self.file_attrs['content'])) self.assertEqual(obj.mime_type, "text/plain") - @mock.patch.object(lib.FollowUpAttachment, 'save', autospec=True) + @mock.patch.object('helpdesk.lib.FollowUpAttachment', 'save', autospec=True) @override_settings(MEDIA_ROOT=MEDIA_DIR) def test_unicode_filename_to_filesystem(self, mock_att_save, mock_queue_save, mock_ticket_save, mock_follow_up_save): """ don't mock saving to filesystem to test file renames caused by storage layer """