test_main.py 文件源码

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

项目:aws-ec2rescue-linux 作者: awslabs 项目源码 文件源码
def test_main__run_backup_empty_backup_value(self,
                                                 main_log_handler_mock,
                                                 debug_log_handler_mock,
                                                 mkdir_mock):
        """Test that an invalid backup value raise an MainInvalidVolumeSpecificationError exception."""
        ec2rl_prediag_test = ec2rlcore.main.Main(debug=True, full_init=True)
        ec2rl_prediag_test.options.global_args["backup"] = ""
        with self.assertRaises(ec2rlcore.main.MainInvalidVolumeSpecificationError):
            with contextlib.redirect_stdout(self.output):
                ec2rl_prediag_test._run_backup()
        self.assertEqual(self.output.getvalue(), "\n-----------[Backup  Creation]-----------\n\nImproper specification"
                                                 " of volumes. Please verify you have specified a volume"
                                                 " such as vol-xxxxx.\n")

        self.assertTrue(main_log_handler_mock.called)
        self.assertTrue(debug_log_handler_mock.called)
        self.assertTrue(mkdir_mock.called)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号