Browse Source

[ADD] Add tests for hooks

pull/398/merge
Aitor Bouzas 6 years ago
committed by Holger Brunn
parent
commit
ded80dd621
  1. 13
      mail_activity_done/tests/test_mail_activity_done.py

13
mail_activity_done/tests/test_mail_activity_done.py

@ -1,7 +1,9 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
from odoo.addons.mail.models.mail_activity import MailActivity
from datetime import date
from ..hooks import pre_init_hook, post_load_hook
class TestMailActivityDoneMethods(TransactionCase):
@ -25,6 +27,17 @@ class TestMailActivityDoneMethods(TransactionCase):
'date_deadline': date.today(),
})
def test_pre_init_hook(self):
pre_init_hook(self.env.cr)
self.env.cr.execute("""
SELECT * FROM mail_activity WHERE done=True
""")
self.assertEquals(self.env.cr.fetchone(), None)
def test_post_load_hook(self):
post_load_hook()
self.assertTrue(hasattr(MailActivity, 'action_feedback_original'))
def test_mail_activity_done(self):
self.act1.done = True
self.assertEquals(self.act1.state, 'done')

Loading…
Cancel
Save