From 1ba22f8d7fe874925fa98a18a9aecf59b39ea208 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Sun, 1 Feb 2015 17:27:40 +0100 Subject: [PATCH] [IMP] use a model for test that is not influenced by the mail module --- auditlog/tests/test_auditlog.py | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/auditlog/tests/test_auditlog.py b/auditlog/tests/test_auditlog.py index bc63dc1a2..f2bf79745 100644 --- a/auditlog/tests/test_auditlog.py +++ b/auditlog/tests/test_auditlog.py @@ -24,33 +24,32 @@ from openerp.tests.common import TransactionCase class TestAuditlog(TransactionCase): def test_LogCreation(self): auditlog_log = self.env['auditlog.log'] - user_model_id = self.env.ref('base.model_res_users').id + groups_model_id = self.env.ref('base.model_res_groups').id self.env['auditlog.rule'].create({ - 'name': 'testrule for users', - 'model_id': user_model_id, + 'name': 'testrule for groups', + 'model_id': groups_model_id, 'log_create': True, 'log_write': True, 'log_unlink': True, 'state': 'subscribed', }) - user = self.env['res.users'].create({ - 'login': 'testuser', - 'name': 'testuser', + group = self.env['res.groups'].create({ + 'name': 'testgroup', }) self.assertTrue(auditlog_log.search([ - ('model_id', '=', user_model_id), + ('model_id', '=', groups_model_id), ('method', '=', 'create'), - ('res_id', '=', user.id), + ('res_id', '=', group.id), ])) - user.write({'name': 'Test User'}) + group.write({'name': 'Testgroup'}) self.assertTrue(auditlog_log.search([ - ('model_id', '=', user_model_id), + ('model_id', '=', groups_model_id), ('method', '=', 'write'), - ('res_id', '=', user.id), + ('res_id', '=', group.id), ])) - user.unlink() + group.unlink() self.assertTrue(auditlog_log.search([ - ('model_id', '=', user_model_id), + ('model_id', '=', groups_model_id), ('method', '=', 'unlink'), - ('res_id', '=', user.id), + ('res_id', '=', group.id), ]))