From 27c3c34c0814b2fe9e5fde13e7ffb54f5fdcbb93 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 3 Jan 2018 15:15:42 +0100 Subject: [PATCH] [FIX] test_mail: adapt query count --- addons/test_mail/tests/test_performance.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py index f7a45403ee3..f24b35b9fa2 100644 --- a/addons/test_mail/tests/test_performance.py +++ b/addons/test_mail/tests/test_performance.py @@ -51,7 +51,7 @@ class TestMailPerformance(TransactionCase): records = self.env['test_performance.mail'].search([]) self.assertEqual(len(records), 5) - with self.assertQueryCount(admin=4, demo=4): # test_mail only: 3 - 3 + with self.assertQueryCount(admin=3, demo=3): # test_mail only: 3 - 3 records.write({'name': 'X'}) @users('admin', 'demo') @@ -61,7 +61,7 @@ class TestMailPerformance(TransactionCase): records = self.env['test_performance.mail'].search([]) self.assertEqual(len(records), 5) - with self.assertQueryCount(admin=6, demo=6): # test_mail only: 5 - 5 + with self.assertQueryCount(admin=5, demo=5): # test_mail only: 5 - 5 records.write({'value': 42}) @users('admin', 'demo') @@ -75,7 +75,7 @@ class TestMailPerformance(TransactionCase): 'partner_id': self.env.ref('base.res_partner_12').id, }) - with self.assertQueryCount(admin=30, demo=41): # test_mail only: 17 - 25 + with self.assertQueryCount(admin=32, demo=44): # test_mail only: 30 - 41 record.track = 'X' @users('admin', 'demo') @@ -91,14 +91,14 @@ class TestMailPerformance(TransactionCase): @warmup def test_create_mail_with_tracking(self): """ Create records inheriting from 'mail.thread' (with field tracking). """ - with self.assertQueryCount(admin=58, demo=78): # test_mail only: 33 - 47 + with self.assertQueryCount(admin=62, demo=84): # test_mail only: 58 - 78 self.env['test_performance.mail'].create({'name': 'X'}) @users('admin', 'emp') @warmup def test_simple(self): """ Create records inheriting from 'mail.thread' (simple models) """ - with self.assertQueryCount(admin=30, emp=39): # test_mail only: 19 - 25 + with self.assertQueryCount(admin=32, emp=42): # test_mail only: 30 - 39 self.env['mail.test.simple'].create({'name': 'Test'}) @@ -126,7 +126,7 @@ class TestAdvMailPerformance(TransactionCase): def test_activity(self): model = self.env['mail.test.activity'] - with self.assertQueryCount(admin=33, emp=42): # test_mail only: 22 - 28 + with self.assertQueryCount(admin=35, emp=45): # test_mail only: 33 - 42 model.create({'name': 'Test'}) @users('admin', 'emp') @@ -137,7 +137,7 @@ class TestAdvMailPerformance(TransactionCase): 'default_res_model': 'mail.test.activity', }) - with self.assertQueryCount(admin=47, emp=52): # test_mail only: 35 - 40 + with self.assertQueryCount(admin=46, emp=51): # test_mail only: 35 - 40 model.create({ 'summary': 'Test Activity', 'res_id': record.id, @@ -215,7 +215,7 @@ class TestHeavyMailPerformance(TransactionCase): }) mail_ids = mail.ids - with self.assertQueryCount(admin=24, emp=48): # test_mail only: 20 - 41 + with self.assertQueryCount(admin=24, emp=47): # test_mail only: 20 - 41 self.env['mail.mail'].browse(mail_ids).send() @mute_logger('odoo.tests', 'odoo.addons.mail.models.mail_mail', 'odoo.models.unlink') @@ -225,7 +225,7 @@ class TestHeavyMailPerformance(TransactionCase): self.umbrella.message_subscribe(self.user_portal.partner_id.ids) record = self.umbrella.sudo(self.env.user) - with self.assertQueryCount(admin=120, emp=151): # test_mail only: 112 - 143 + with self.assertQueryCount(admin=126, emp=158): # test_mail only: 120 - 151 record.message_post( body='

Test Post Performances

', message_type='comment', subtype='mail.mt_comment') @@ -241,7 +241,7 @@ class TestHeavyMailPerformance(TransactionCase): record = self.umbrella.sudo(self.env.user) template = self.env.ref('test_mail.mail_test_tpl') - with self.assertQueryCount(admin=176, emp=223): # test_mail only: 166 - 211 + with self.assertQueryCount(admin=184, emp=231): # test_mail only: 176 - 223 record.message_post_with_template(template.id, message_type='comment', composition_mode='comment') self.assertEqual(record.message_ids[0].body, '

Adding stuff on %s

' % record.name) @@ -257,7 +257,7 @@ class TestHeavyMailPerformance(TransactionCase): customer_id = self.customer.id user_id = self.user_portal.id - with self.assertQueryCount(admin=327, emp=397): # test_mail only: 298 - 359 + with self.assertQueryCount(admin=345, emp=418): # test_mail only: 327 - 397 rec = self.env['mail.test.full'].create({ 'name': 'Test', 'umbrella_id': umbrella_id,