def test_no_file_path(self):
"""
Tests the save_attachment function.
"""
mock_settings_1 = {
'ALLOWED_EMAIL_ATTACHMENTS': ('application/java',)
}
with patch.dict('sifter.mailsifter.accessors.settings.MAILSIFTER',
mock_settings_1):
self.msg.attach(self.java)
attachment = get_first_attachment(self.msg)
with patch('sifter.mailsifter.attachments.settings',
self.mock_settings):
with LogCapture() as log_capture:
actual = attachments.save_attachment(attachment)
expected = None
self.assertEqual(actual, expected)
msg = 'The attachment %s is not an allowed file type' \
% self.java_file
log_capture.check(
('sifter.mailsifter.attachments', 'WARNING', msg),
)
评论列表
文章目录