def test_send_mail(self, os_system_patch): Util.send_email(["*****@*****.**"], "hello", "hello") os_system_patch.assert_has_calls([ call( 'echo "hello" | mailx -s "hello" [email protected]' ) ])
def _report_error(self, name): error_subject = "Error for " + name exec_tb = traceback.format_exc() message = "Error in executing {}. \n Stacktrace: \n {}".format( name, exec_tb) logging.error(error_subject) Util.send_email(self._execution_system.config_service.emails, error_subject, message)
def _report_success(self, name): success_subject = "Success for " + name logging.info(success_subject) Util.send_email(self._execution_system.config_service.emails, success_subject, success_subject)