Initial commit: Odoo 18.0-20251222 extra-addons
This commit is contained in:
1
scheduler_error_mailer/tests/__init__.py
Executable file
1
scheduler_error_mailer/tests/__init__.py
Executable file
@@ -0,0 +1 @@
|
||||
from . import test_scheduler_error_mailer
|
||||
32
scheduler_error_mailer/tests/test_scheduler_error_mailer.py
Executable file
32
scheduler_error_mailer/tests/test_scheduler_error_mailer.py
Executable file
@@ -0,0 +1,32 @@
|
||||
# Copyright 2023 Hunki Enterprises BV
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from odoo.addons.base.tests.common import BaseCommon
|
||||
from odoo.addons.scheduler_error_mailer.hooks import post_init_hook
|
||||
|
||||
|
||||
class TestSchedulerErrorMailer(BaseCommon):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.cron = self.env.ref("scheduler_error_mailer.test_scheduler_error_mailer")
|
||||
|
||||
def test_error_cron(self):
|
||||
with (
|
||||
self.assertLogs(
|
||||
"odoo.addons.scheduler_error_mailer.models.ir_cron", "DEBUG"
|
||||
),
|
||||
patch.object(self.env.cr, "rollback"),
|
||||
):
|
||||
self.cron._handle_callback_exception(
|
||||
self.cron.name,
|
||||
self.cron.ir_actions_server_id.id,
|
||||
Exception("hello world"),
|
||||
)
|
||||
|
||||
def test_init_hook(self):
|
||||
post_init_hook(self.env)
|
||||
self.assertFalse(
|
||||
self.env["ir.cron"].search([("email_template_id", "=", False)])
|
||||
)
|
||||
Reference in New Issue
Block a user