Fix autofill test

This commit is contained in:
Martin Whitehouse 2022-06-20 17:50:49 +02:00
parent 0e571ddebc
commit dd7ef6f0ed
No known key found for this signature in database
GPG Key ID: 8492A7A45769CD35

View File

@ -100,7 +100,7 @@ class AttachmentUnitTests(TestCase):
)
)
@mock.patch('helpdesk.lib.FollowUpAttachment', autospec=True)
@mock.patch('models.FollowUpAttachment', autospec=True)
def test_unicode_attachment_filename(self, mock_att_save, mock_queue_save, mock_ticket_save, mock_follow_up_save):
""" check utf-8 data is parsed correctly """
filename, fileobj = lib.process_attachments(self.follow_up, [self.test_file])[0]
@ -113,8 +113,7 @@ class AttachmentUnitTests(TestCase):
)
self.assertEqual(filename, self.file_attrs['filename'])
@mock.patch('helpdesk.lib.FollowUpAttachment', autospec=True)
def test_autofill(self, mock_att_save, mock_queue_save, mock_ticket_save, mock_follow_up_save):
def test_autofill(self, mock_att_save, mock_queue_save, mock_ticket_save):
""" check utf-8 data is parsed correctly """
obj = models.FollowUpAttachment.objects.create(
followup=self.follow_up,
@ -147,7 +146,6 @@ class AttachmentUnitTests(TestCase):
self.assertEqual(obj.size, len(self.file_attrs['content']))
self.assertEqual(obj.mime_type, "text/plain")
# @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 """