feat(fusion_accounting_followup): fusion.followup.run audit model
Made-with: Cursor
This commit is contained in:
@@ -4,3 +4,4 @@ from . import test_risk_scorer
|
||||
from . import test_tone_selector
|
||||
from . import test_followup_text_generator
|
||||
from . import test_fusion_followup_level
|
||||
from . import test_fusion_followup_run
|
||||
|
||||
44
fusion_accounting_followup/tests/test_fusion_followup_run.py
Normal file
44
fusion_accounting_followup/tests/test_fusion_followup_run.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo.tests import tagged
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestFusionFollowupRun(TransactionCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.partner = cls.env['res.partner'].create({'name': 'Run Test Partner'})
|
||||
cls.level = cls.env['fusion.followup.level'].create({
|
||||
'name': 'Reminder', 'sequence': 301, 'delay_days': 7, 'tone': 'gentle',
|
||||
})
|
||||
|
||||
def test_create_minimal(self):
|
||||
run = self.env['fusion.followup.run'].create({
|
||||
'partner_id': self.partner.id,
|
||||
'level_id': self.level.id,
|
||||
})
|
||||
self.assertEqual(run.state, 'draft')
|
||||
self.assertTrue(run.execution_date)
|
||||
|
||||
def test_action_mark_sent(self):
|
||||
run = self.env['fusion.followup.run'].create({
|
||||
'partner_id': self.partner.id,
|
||||
'level_id': self.level.id,
|
||||
})
|
||||
run.action_mark_sent()
|
||||
self.assertEqual(run.state, 'sent')
|
||||
|
||||
def test_action_mark_failed_records_error(self):
|
||||
run = self.env['fusion.followup.run'].create({
|
||||
'partner_id': self.partner.id,
|
||||
})
|
||||
run.action_mark_failed(error='SMTP unreachable')
|
||||
self.assertEqual(run.state, 'failed')
|
||||
self.assertEqual(run.error_message, 'SMTP unreachable')
|
||||
|
||||
def test_partner_required(self):
|
||||
with self.assertRaises(Exception):
|
||||
self.env['fusion.followup.run'].create({
|
||||
'level_id': self.level.id,
|
||||
})
|
||||
Reference in New Issue
Block a user