Skip to content

Commit

Permalink
[imp] test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
m1k3lm committed Jun 1, 2024
1 parent ae9f7ad commit 713f952
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mgmtsystem_action/models/mgmtsystem_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class MgmtsystemAction(models.Model):
number_of_days_to_close = fields.Integer(
"# of days to close", compute="_compute_number_of_days_to_close", store=True
)
reference = fields.Char(required=True, readonly=True, default=lambda self: _("New"))
reference = fields.Char(readonly=True)
user_id = fields.Many2one(
"res.users",
"Responsible",
Expand Down
13 changes: 12 additions & 1 deletion mgmtsystem_action/tests/test_create_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from datetime import datetime, timedelta
from unittest import mock

from odoo import exceptions
from odoo import _, exceptions
from odoo.tests import common


Expand Down Expand Up @@ -39,6 +39,14 @@ def test_create_action(self):
self.assertFalse(self.record.date_open)
self.record.stage_id = stage
self._assert_date_equal(self.record.date_open)
new_record = self.env["mgmtsystem.action"].create(
{
"reference": "SampleReference",
"name": "SampleAction",
"type_action": "immediate",
}
)
self.assertEqual(new_record.reference, _("SampleReference"))

def test_case_close(self):
"""Test object close state."""
Expand All @@ -54,6 +62,7 @@ def test_case_close(self):
self.assertTrue(True)
stage = self.env.ref("mgmtsystem_action.stage_close")
self.record.write({"stage_id": stage.id})
self.assertTrue(self.record.number_of_days_to_close <= 0)

def test_get_action_url(self):
"""Test if action url start with http."""
Expand All @@ -75,6 +84,8 @@ def test_process_reminder_queue(self):
with mock.patch.object(type(tmpl_model), "send_mail") as mocked:
self.env["mgmtsystem.action"].process_reminder_queue()
mocked.assert_called_with(self.record.id)
self.env["mgmtsystem.action"].process_reminder_queue(-100)
mocked.assert_called_with(self.record.id)

def test_stage_groups(self):
"""Check if stage_groups return all stages."""
Expand Down

0 comments on commit 713f952

Please sign in to comment.