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)
评论列表
文章目录