[UPD] test_mail: update query counters at current runbot state

PURPOSE

Reorganize and lint mail.channel code. Purpose is to ease future modifications
linked to groups and channels in mail / Discuss.

SPECIFICATIONS

Purpose is to better spot future query counter updates by ensuring current
thresholds effectively match runbot state. Some query counters for admin
are currently a bit lower than expected, probably linked to various ORM
improvements and cleaning done since last counter update.

LINKS

Prepares Task ID-2070632 (Discuss channel task)
Prepares Task ID-2419762 (SM channel task)
COM PR odoo/odoo#64862
This commit is contained in:
Thibault Delavallée
2021-01-21 14:35:05 +00:00
parent e72dd61c94
commit b690b3f455
+7 -7
View File
@@ -270,7 +270,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
'partner_ids': [(4, customer_id)],
})
with self.assertQueryCount(__system__=29, emp=32):
with self.assertQueryCount(__system__=25, emp=32):
composer.send_mail()
@users('__system__', 'emp')
@@ -290,7 +290,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
}).create({})
composer.onchange_template_id_wrapper()
with self.assertQueryCount(__system__=37, emp=40):
with self.assertQueryCount(__system__=33, emp=40):
composer.send_mail()
# remove created partner to ensure tests are the same each run
@@ -331,7 +331,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
def test_message_log_with_post(self):
record = self.env['mail.test.simple'].create({'name': 'Test'})
with self.assertQueryCount(__system__=5, emp=6):
with self.assertQueryCount(__system__=3, emp=6):
record.message_post(
body='<p>Test message_post as log</p>',
subtype_xmlid='mail.mt_note',
@@ -342,7 +342,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
def test_message_post_no_notification(self):
record = self.env['mail.test.simple'].create({'name': 'Test'})
with self.assertQueryCount(__system__=5, emp=6):
with self.assertQueryCount(__system__=3, emp=6):
record.message_post(
body='<p>Test Post Performances basic</p>',
partner_ids=[],
@@ -355,7 +355,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
def test_message_post_one_email_notification(self):
record = self.env['mail.test.simple'].create({'name': 'Test'})
with self.assertQueryCount(__system__=30, emp=31):
with self.assertQueryCount(__system__=28, emp=31):
record.message_post(
body='<p>Test Post Performances with an email ping</p>',
partner_ids=self.customer.ids,
@@ -367,7 +367,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
def test_message_post_one_inbox_notification(self):
record = self.env['mail.test.simple'].create({'name': 'Test'})
with self.assertQueryCount(__system__=14, emp=17):
with self.assertQueryCount(__system__=12, emp=17):
record.message_post(
body='<p>Test Post Performances with an inbox ping</p>',
partner_ids=self.user_test.partner_id.ids,
@@ -951,7 +951,7 @@ class TestMailHeavyPerformancePost(BaseMailPerformance):
]
self.attachements = self.env['ir.attachment'].with_user(self.env.user).create(self.vals)
attachement_ids = self.attachements.ids
with self.assertQueryCount(emp=81):
with self.assertQueryCount(emp=79):
self.cr.sql_log = self.warm and self.cr.sql_log_count
record.with_context({}).message_post(
body='<p>Test body <img src="cid:cid1"> <img src="cid:cid2"></p>',