test_models.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:cyphon 作者: dunbarcyber 项目源码 文件源码
def test_no_match_without_default(self):
        """
        Tests the process_email receiver for an email that doesn't match
        an existing MailChute when a default MailMunger is not enabled.
        """
        doc_obj = self.doc_obj
        doc_obj.data['Subject'] = 'nothing to see here'
        mock_config = {
            'DEFAULT_MUNGER': 'default_mail',
            'DEFAULT_MUNGER_ENABLED': False
        }
        with patch('distilleries.models.Distillery.save_data') 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, False)
                    self.assertIs(mock_catch_email.called, False)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号