From 91504434653f56cfd0b1b1fe72c275312154b341 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 8 Sep 2017 10:38:56 +0200 Subject: [PATCH] [IMP] mail: tests: clean server actions tests Purpose is to lessen noise and make tests less low-level. Including : * remove unnecessary fail string; * remove unnecessary method return value test as this is low level; --- addons/mail/tests/test_ir_actions.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/addons/mail/tests/test_ir_actions.py b/addons/mail/tests/test_ir_actions.py index 074f603a43f..543c27d4a21 100644 --- a/addons/mail/tests/test_ir_actions.py +++ b/addons/mail/tests/test_ir_actions.py @@ -6,9 +6,7 @@ from odoo.addons.base.tests.test_ir_actions import TestServerActionsBase class TestServerActionsEmail(TestServerActionsBase): - def test_email_action(self): - """ Test ir.actions.server email type """ - # create email_template + def test_action_email(self): email_template = self.env['mail.template'].create({ 'name': 'TestTemplate', 'email_from': 'myself@example.com', @@ -19,17 +17,14 @@ class TestServerActionsEmail(TestServerActionsBase): 'body_html': '

Dear ${object.name}, your parent is ${object.parent_id and object.parent_id.name or "False"}

', }) self.action.write({'state': 'email', 'template_id': email_template.id}) - run_res = self.action.with_context(self.context).run() - self.assertFalse(run_res, 'ir_actions_server: email server action correctly finished should return False') + self.action.with_context(self.context).run() # check an email is waiting for sending mail = self.env['mail.mail'].search([('subject', '=', 'About TestingPartner')]) - self.assertEqual(len(mail), 1, 'ir_actions_server: TODO') + self.assertEqual(len(mail), 1) # check email content - self.assertEqual(mail.body, '

Dear TestingPartner, your parent is False

', - 'ir_actions_server: TODO') + self.assertEqual(mail.body, '

Dear TestingPartner, your parent is False

') - def test_followers_action(self): - """ Test ir.actions.server email type """ + def test_action_followers(self): self.test_partner.message_unsubscribe(self.test_partner.message_partner_ids.ids) self.action.write({ 'state': 'followers',