def test_match_with_default(self):
"""
Tests the process_email receiver for an email that matches an
existing MailChute.
"""
doc_obj = self.doc_obj
doc_obj.data['Subject'] = 'critical alert'
mock_config = {
'DEFAULT_MUNGER': 'default_mail',
'DEFAULT_MUNGER_ENABLED': True
}
with patch('distilleries.models.Distillery.save_data',
return_value='id_123') as mock_save:
with patch.dict('sifter.mailsifter.mailchutes.models.conf.MAILSIFTER',
mock_config):
with patch('sifter.mailsifter.mailchutes.models.MailChuteManager._process_with_default') \
as mock_catch_email:
MailChute.objects.process(doc_obj)
self.assertIs(mock_save.called, True)
self.assertIs(mock_catch_email.called, False)
评论列表
文章目录