[IMP] test_mail(_*): update query counters

Based on last runbot counters

Part-of: odoo/odoo#155717
This commit is contained in:
Thibault Delavallée
2024-02-28 19:49:12 +00:00
parent 80765a0c7f
commit 15ecc92c84
2 changed files with 22 additions and 22 deletions
+21 -21
View File
@@ -286,11 +286,11 @@ class TestBaseAPIPerformance(BaseMailPerformance):
# voip module read activity_type during create leading to one less query in enterprise on action_feedback
_category = activity.activity_type_id.category
with self.assertQueryCount(admin=13, employee=13):
with self.assertQueryCount(admin=12, employee=12):
activity.action_feedback(feedback='Zizisse Done !')
@warmup
def test_adv_activity_mixin_batched(self):
def test_activity_mixin_batched(self):
records = self.env['mail.test.activity'].create([{'name': 'Test'}] * 10)
MailActivity = self.env['mail.activity'].with_context({
'default_res_model': 'mail.test.activity',
@@ -304,7 +304,7 @@ class TestBaseAPIPerformance(BaseMailPerformance):
} for record in records])
self.env.invalidate_all()
with self.assertQueryCount(3):
with self.assertQueryCount(2):
records.mapped('activity_date_deadline')
@users('admin', 'employee')
@@ -321,7 +321,7 @@ class TestBaseAPIPerformance(BaseMailPerformance):
record.write({'name': 'Dupe write'})
with self.assertQueryCount(admin=14, employee=14):
with self.assertQueryCount(admin=13, employee=13):
record.action_close('Dupe feedback')
self.assertEqual(record.activity_ids, self.env['mail.activity'])
@@ -347,7 +347,7 @@ class TestBaseAPIPerformance(BaseMailPerformance):
record.write({'name': 'Dupe write'})
with self.assertQueryCount(admin=17, employee=17): # com+tm 16/16
with self.assertQueryCount(admin=15, employee=15): # com+tm 14/14
record.action_close('Dupe feedback', attachment_ids=attachments.ids)
# notifications
@@ -373,7 +373,7 @@ class TestBaseAPIPerformance(BaseMailPerformance):
'partner_ids': [(4, customer_id)],
})
with self.assertQueryCount(admin=39, employee=39): # com 35/35
with self.assertQueryCount(admin=39, employee=39):
composer._action_send_mail()
@users('admin', 'employee')
@@ -394,7 +394,7 @@ class TestBaseAPIPerformance(BaseMailPerformance):
'partner_ids': [(4, customer.id)],
})
with self.assertQueryCount(admin=40, employee=40): # com 35/35
with self.assertQueryCount(admin=40, employee=40):
composer._action_send_mail()
@users('admin', 'employee')
@@ -418,7 +418,7 @@ class TestBaseAPIPerformance(BaseMailPerformance):
composer_form.attachment_ids.add(attachment)
composer = composer_form.save()
with self.assertQueryCount(admin=55, employee=55): # tm+com 53/53
with self.assertQueryCount(admin=55, employee=55): # tm+com 54/54
composer._action_send_mail()
# notifications
@@ -472,7 +472,7 @@ class TestBaseAPIPerformance(BaseMailPerformance):
test_record, test_template = self._create_test_records()
test_template.write({'attachment_ids': [(5, 0)]})
with self.assertQueryCount(admin=27, employee=27): # tm 15/15 / com 25/25
with self.assertQueryCount(admin=27, employee=27): # tm 16/16 / com 26/26
composer = self.env['mail.compose.message'].with_context({
'default_composition_mode': 'comment',
'default_model': test_record._name,
@@ -496,7 +496,7 @@ class TestBaseAPIPerformance(BaseMailPerformance):
def test_mail_composer_w_template_attachments(self):
test_record, test_template = self._create_test_records()
with self.assertQueryCount(admin=28, employee=28): # tm 16/16 / com 26/26
with self.assertQueryCount(admin=28, employee=28): # tm 17/17 / com 27/27
composer = self.env['mail.compose.message'].with_context({
'default_composition_mode': 'comment',
'default_model': test_record._name,
@@ -525,7 +525,7 @@ class TestBaseAPIPerformance(BaseMailPerformance):
test_template.write({'attachment_ids': [(5, 0)]})
customer = self.env['res.partner'].browse(self.customer.ids)
with self.assertQueryCount(admin=34, employee=34): # tm 22/22 / com 32/32
with self.assertQueryCount(admin=34, employee=34): # tm 23/23 / com 33/33
composer_form = Form(
self.env['mail.compose.message'].with_context({
'default_composition_mode': 'comment',
@@ -555,7 +555,7 @@ class TestBaseAPIPerformance(BaseMailPerformance):
test_record, test_template = self._create_test_records()
customer = self.env['res.partner'].browse(self.customer.ids)
with self.assertQueryCount(admin=34, employee=34): # tm 22/22 / com 32/32
with self.assertQueryCount(admin=34, employee=34): # tm 23/23 / com 32/32
composer_form = Form(
self.env['mail.compose.message'].with_context({
'default_composition_mode': 'comment',
@@ -878,7 +878,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
record = self.container.with_user(self.env.user)
# about 20 (19?) queries per additional customer group
with self.assertQueryCount(admin=61, employee=60): # com 55/54
with self.assertQueryCount(admin=60, employee=59):
record.message_post(
body=Markup('<p>Test Post Performances</p>'),
message_type='comment',
@@ -896,7 +896,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
template = self.env.ref('test_mail.mail_test_container_tpl')
# about 20 (19 ?) queries per additional customer group
with self.assertQueryCount(admin=70, employee=69): # com 62/61
with self.assertQueryCount(admin=69, employee=68):
record.message_post_with_source(
template,
message_type='comment',
@@ -920,7 +920,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
'default_template_id': test_template.id,
}).create({})
with self.assertQueryCount(admin=151, employee=151): # com 141/141
with self.assertQueryCount(admin=151, employee=151):
messages_as_sudo = test_records.message_post_with_source(
'test_mail.mail_template_simple_test',
render_values={'partner': self.user_test.partner_id},
@@ -1006,7 +1006,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
customer_id = self.customer.id
user_id = self.user_portal.id
with self.assertQueryCount(admin=102, employee=102):
with self.assertQueryCount(admin=101, employee=101):
rec = self.env['mail.test.ticket'].create({
'name': 'Test',
'container_id': container_id,
@@ -1035,7 +1035,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
rec1 = rec.with_context(active_test=False) # to see inactive records
self.assertEqual(rec1.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id)
self.assertEqual(len(rec1.message_ids), 1)
with self.assertQueryCount(admin=63, employee=63):
with self.assertQueryCount(admin=62, employee=62):
rec.write({
'name': 'Test2',
'container_id': self.container.id,
@@ -1072,7 +1072,7 @@ class TestMailAPIPerformance(BaseMailPerformance):
rec1 = rec.with_context(active_test=False) # to see inactive records
self.assertEqual(rec1.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id)
with self.assertQueryCount(admin=70, employee=70):
with self.assertQueryCount(admin=69, employee=69):
rec.write({
'name': 'Test2',
'container_id': container_id,
@@ -1264,7 +1264,7 @@ class TestMailFormattersPerformance(BaseMailPerformance):
"""
messages_all = self.messages_all.with_env(self.env)
with self.assertQueryCount(employee=26): # test_mail: 25
with self.assertQueryCount(employee=26):
res = messages_all.message_format()
self.assertEqual(len(res), 2*2)
@@ -1277,7 +1277,7 @@ class TestMailFormattersPerformance(BaseMailPerformance):
def test_message_format_single(self):
message = self.messages_all[0].with_env(self.env)
with self.assertQueryCount(employee=23): # test_mail: 22
with self.assertQueryCount(employee=23):
res = message.message_format()
self.assertEqual(len(res), 1)
@@ -1382,7 +1382,7 @@ class TestPerformance(BaseMailPerformance):
attachments = self.env['ir.attachment'].with_user(self.env.user).create(self.test_attachments_vals)
# enable_logging = self.cr._enable_logging() if self.warm else nullcontext()
# with self.assertQueryCount(employee=63), enable_logging:
with self.assertQueryCount(employee=69): # com 63
with self.assertQueryCount(employee=68):
record_container.with_context({}).message_post(
body=Markup('<p>Test body <img src="cid:cid1"> <img src="cid:cid2"></p>'),
subject='Test Subject',
@@ -91,7 +91,7 @@ class TestMailPerformance(FullBaseMailPerformance):
record_ticket = self.env['mail.test.ticket.mc'].browse(self.record_ticket.ids)
attachments = self.env['ir.attachment'].create(self.test_attachments_vals)
with self.assertQueryCount(employee=101): # test_mail_full: 95
with self.assertQueryCount(employee=99): # test_mail_full: 95
new_message = record_ticket.message_post(
attachment_ids=attachments.ids,
body=Markup('<p>Test Content</p>'),