def test_allowed_file(self):
"""
Tests the get_file_path function for an allowed file type.
"""
self.msg.attach(self.image)
attachment = get_first_attachment(self.msg)
mock_uuid = Mock()
mock_uuid.hex = self.uuid
with patch('sifter.mailsifter.attachments.uuid.uuid4',
return_value=mock_uuid):
with patch.dict('sifter.mailsifter.attachments.settings.MAILSIFTER',
self.mock_mailsifter_settings):
actual = attachments.get_file_path(attachment, self.company)
expected = '%s/test-attachments/%s.jpeg' \
% (self.company.uuid.hex, self.uuid)
self.assertEqual(actual, expected)
评论列表
文章目录