test_models.py 文件源码

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

项目:cyphon 作者: dunbarcyber 项目源码 文件源码
def test_no_match_with_default(self):
        """
        Tests the process_email receiver for an email that doesn't match
        an existing MailChute when a default MailMunger is enabled.
        """
        doc_obj = self.doc_obj
        doc_obj.data['Subject'] = 'nothing to see here'
        mock_config = {
            'DEFAULT_MUNGER': 'default_mail',
            'DEFAULT_MUNGER_ENABLED': True
        }
        with patch.dict('sifter.mailsifter.mailchutes.models.conf.MAILSIFTER',
                        mock_config):
            with patch('sifter.mailsifter.mailchutes.models.MailChuteManager._process_with_default') \
                    as mock_default_process:
                MailChute.objects.process(doc_obj)
                mock_default_process.assert_called_once_with(doc_obj)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号