test_functional.py 文件源码

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

项目:cyphon 作者: dunbarcyber 项目源码 文件源码
def test_validation_error(self):
        """
        Tests the configuration test tool when a ValidationError is raised.
        """
        self.page.config_test_value = 'test text'

        with patch(
            'sifter.mailsifter.mailcondensers.admin.MailCondenserAdmin._get_result',
            side_effect=ValidationError('foo')):
            with LogCapture('cyphon.admin') as log_capture:

                actual = self.page.run_test()
                expected = "A validation error occurred: ['foo']"
                self.assertEqual(actual, expected)

                msg = 'An error occurred while initializing a config test: ' + \
                      '<WSGIRequest: POST ' + \
                      "'/admin/mailcondensers/mailcondenser/1/change/test/'>"
                log_capture.check(
                    ('cyphon.admin', 'ERROR', msg),
                )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号