From 5f7da6920bf21fcad99ee88db45690d4b8969071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 5 Sep 2022 11:21:54 +0000 Subject: [PATCH] [IMP] test_mail(_full): update counters to runbot state Some differences between community / enterprise seems to have vanished. Task-2710804 (Mail: Clean MailThread API) closes odoo/odoo#99566 Signed-off-by: Thibault Delavallee (tde) --- addons/test_mail/tests/test_performance.py | 48 +++++++++---------- .../tests/test_mail_performance.py | 2 +- addons/test_mail_full/tests/test_rating.py | 4 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py index 39f9481bc33..239fdf8e470 100644 --- a/addons/test_mail/tests/test_performance.py +++ b/addons/test_mail/tests/test_performance.py @@ -260,7 +260,7 @@ class TestMailAPIPerformance(BaseMailPerformance): record.write({'name': 'Dupe write'}) - with self.assertQueryCount(__system__=15, employee=17): # com+tm 15/17 + with self.assertQueryCount(__system__=15, employee=17): record.action_close('Dupe feedback') self.assertEqual(record.activity_ids, self.env['mail.activity']) @@ -313,7 +313,7 @@ class TestMailAPIPerformance(BaseMailPerformance): 'partner_ids': [(4, customer_id)], }) - with self.assertQueryCount(__system__=27, employee=33): # tm 26/32 + with self.assertQueryCount(__system__=26, employee=32): composer._action_send_mail() @users('__system__', 'employee') @@ -335,7 +335,7 @@ class TestMailAPIPerformance(BaseMailPerformance): 'partner_ids': [(4, customer.id)], }) - with self.assertQueryCount(__system__=32, employee=40): # tm 29/37 + with self.assertQueryCount(__system__=29, employee=37): composer._action_send_mail() @users('__system__', 'employee') @@ -346,7 +346,7 @@ class TestMailAPIPerformance(BaseMailPerformance): test_record = self.env['mail.test.ticket'].browse(self.test_record_full.id) customer = self.env['res.partner'].browse(self.customer.ids) attachments = self.env['ir.attachment'].with_user(self.env.user).create(self.test_attachments_vals) - with self.assertQueryCount(__system__=20, employee=20): # tm 17/17 / com 18/18 + with self.assertQueryCount(__system__=18, employee=18): # tm+com 16/16 composer_form = Form( self.env['mail.compose.message'].with_context({ 'default_composition_mode': 'comment', @@ -360,7 +360,7 @@ class TestMailAPIPerformance(BaseMailPerformance): composer_form.attachment_ids.add(attachment) composer = composer_form.save() - with self.assertQueryCount(__system__=42, employee=50): # tm 38/46 / com 41/49 + with self.assertQueryCount(__system__=39, employee=47): # tm+com 38/46 composer._action_send_mail() # notifications @@ -386,7 +386,7 @@ class TestMailAPIPerformance(BaseMailPerformance): 'partner_ids': [(4, customer_id)], }) - with self.assertQueryCount(__system__=27, employee=33): # tm 26/32 + with self.assertQueryCount(__system__=26, employee=32): composer._action_send_mail() @users('__system__', 'employee') @@ -399,7 +399,7 @@ class TestMailAPIPerformance(BaseMailPerformance): test_record = self.env['mail.test.ticket'].browse(self.test_record_full.id) test_template = self.env['mail.template'].browse(self.test_template_full.id) - with self.assertQueryCount(__system__=28, employee=29): # tm 13/14 / com 27/28 + with self.assertQueryCount(__system__=23, employee=24): # tm 13/14 / com 22/23 composer = self.env['mail.compose.message'].with_context({ 'default_composition_mode': 'comment', 'default_model': test_record._name, @@ -408,7 +408,7 @@ class TestMailAPIPerformance(BaseMailPerformance): }).create({}) composer._onchange_template_id_wrapper() - with self.assertQueryCount(__system__=26, employee=32): # tm 25/31 + with self.assertQueryCount(__system__=25, employee=31): composer._action_send_mail() # notifications @@ -426,7 +426,7 @@ class TestMailAPIPerformance(BaseMailPerformance): test_record = self.env['mail.test.ticket'].browse(self.test_record_full.id) test_template = self.env['mail.template'].browse(self.test_template_full.id) - with self.assertQueryCount(__system__=31, employee=32): # tm 14/15 / com 30/31 + with self.assertQueryCount(__system__=24, employee=25): # tm 14/15 / com 23/24 composer = self.env['mail.compose.message'].with_context({ 'default_composition_mode': 'comment', 'default_model': test_record._name, @@ -435,7 +435,7 @@ class TestMailAPIPerformance(BaseMailPerformance): }).create({}) composer._onchange_template_id_wrapper() - with self.assertQueryCount(__system__=38, employee=49): # tm 33/44 + with self.assertQueryCount(__system__=33, employee=44): composer._action_send_mail() # notifications @@ -458,7 +458,7 @@ class TestMailAPIPerformance(BaseMailPerformance): test_record = self.env['mail.test.ticket'].browse(self.test_record_full.id) test_template = self.env['mail.template'].browse(self.test_template_full.id) customer = self.env['res.partner'].browse(self.customer.ids) - with self.assertQueryCount(__system__=42, employee=44): # tm 29/31 / com 39/41 + with self.assertQueryCount(__system__=40, employee=42): # tm 28/30 / com 37/39 composer_form = Form( self.env['mail.compose.message'].with_context({ 'default_composition_mode': 'comment', @@ -469,7 +469,7 @@ class TestMailAPIPerformance(BaseMailPerformance): ) composer = composer_form.save() - with self.assertQueryCount(__system__=36, employee=42): # tm 35/41 + with self.assertQueryCount(__system__=35, employee=41): composer._action_send_mail() # notifications @@ -490,7 +490,7 @@ class TestMailAPIPerformance(BaseMailPerformance): test_record = self.env['mail.test.ticket'].browse(self.test_record_full.id) test_template = self.env['mail.template'].browse(self.test_template_full.id) customer = self.env['res.partner'].browse(self.customer.ids) - with self.assertQueryCount(__system__=43, employee=45): # tm 30/32 / com 40/42 + with self.assertQueryCount(__system__=41, employee=43): # tm 29/31 / com 38/40 composer_form = Form( self.env['mail.compose.message'].with_context({ 'default_composition_mode': 'comment', @@ -501,7 +501,7 @@ class TestMailAPIPerformance(BaseMailPerformance): ) composer = composer_form.save() - with self.assertQueryCount(__system__=52, employee=69): # tm 47/64 + with self.assertQueryCount(__system__=47, employee=64): composer._action_send_mail() # notifications @@ -522,7 +522,7 @@ class TestMailAPIPerformance(BaseMailPerformance): def test_message_assignation_email(self): self.user_test.write({'notification_type': 'email'}) record = self.env['mail.test.track'].create({'name': 'Test'}) - with self.assertQueryCount(__system__=28, employee=29): # tm 27/28 + with self.assertQueryCount(__system__=27, employee=28): record.write({ 'user_id': self.user_test.id, }) @@ -575,7 +575,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__=25, employee=29): # tm 24/28 + with self.assertQueryCount(__system__=24, employee=28): record.message_post( body='

Test Post Performances with an email ping

', partner_ids=self.customer.ids, @@ -769,7 +769,7 @@ class TestMailComplexPerformance(BaseMailPerformance): record = self.container.with_user(self.env.user) # about 20 (19?) queries per additional customer group - with self.assertQueryCount(__system__=38, employee=39): # tm 36/37 + with self.assertQueryCount(__system__=35, employee=36): record.message_post( body='

Test Post Performances

', message_type='comment', @@ -787,7 +787,7 @@ class TestMailComplexPerformance(BaseMailPerformance): template_id = self.env.ref('test_mail.mail_test_container_tpl').id # about 20 (19 ?) queries per additional customer group - with self.assertQueryCount(__system__=47, employee=48): # tm 43/44 + with self.assertQueryCount(__system__=42, employee=43): 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) @@ -850,7 +850,7 @@ class TestMailComplexPerformance(BaseMailPerformance): }) rec1 = rec.with_context(active_test=False) # to see inactive records self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id) - with self.assertQueryCount(__system__=25, employee=26): # tm 24/25 + with self.assertQueryCount(__system__=24, employee=25): rec.write({'user_id': self.user_portal.id}) self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id | self.user_portal.partner_id) # write tracking message @@ -870,7 +870,7 @@ class TestMailComplexPerformance(BaseMailPerformance): customer_id = self.customer.id user_id = self.user_portal.id - with self.assertQueryCount(__system__=59, employee=60): # tm 56/57 + with self.assertQueryCount(__system__=56, employee=57): # tm 56/57 rec = self.env['mail.test.ticket'].create({ 'name': 'Test', 'container_id': container_id, @@ -899,7 +899,7 @@ class TestMailComplexPerformance(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(__system__=38, employee=38): # tm 36/36 + with self.assertQueryCount(__system__=36, employee=36): rec.write({ 'name': 'Test2', 'container_id': self.container.id, @@ -936,7 +936,7 @@ class TestMailComplexPerformance(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(__system__=38, employee=38): # tm 36/36 + with self.assertQueryCount(__system__=36, employee=36): rec.write({ 'name': 'Test2', 'container_id': container_id, @@ -969,7 +969,7 @@ class TestMailComplexPerformance(BaseMailPerformance): rec1 = rec.with_context(active_test=False) # to see inactive records self.assertEqual(rec1.message_partner_ids, self.partners | self.env.user.partner_id | self.user_portal.partner_id) - with self.assertQueryCount(__system__=20, employee=21): # tm 19/20 + with self.assertQueryCount(__system__=19, employee=20): rec.write({ 'name': 'Test2', 'customer_id': customer_id, @@ -1197,7 +1197,7 @@ class TestMailHeavyPerformancePost(BaseMailPerformance): ('attach tuple 3', "attachement tupple content 3", {'cid': 'cid2'}), ] attachments = self.env['ir.attachment'].with_user(self.env.user).create(self.test_attachments_vals) - with self.assertQueryCount(employee=54): # tm 50 + with self.assertQueryCount(employee=49): self.cr.sql_log = self.warm and self.cr.sql_log_count record_container.with_context({}).message_post( body='

Test body

', diff --git a/addons/test_mail_full/tests/test_mail_performance.py b/addons/test_mail_full/tests/test_mail_performance.py index e0b4757f2b1..8936b6c934c 100644 --- a/addons/test_mail_full/tests/test_mail_performance.py +++ b/addons/test_mail_full/tests/test_mail_performance.py @@ -81,7 +81,7 @@ class TestMailPerformance(BaseMailPerformance): 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=68): # tmf: 61 / com: 68 + with self.assertQueryCount(employee=62): # tmf: 60 new_message = record_ticket.message_post( attachment_ids=attachments.ids, body='

Test Content

', diff --git a/addons/test_mail_full/tests/test_rating.py b/addons/test_mail_full/tests/test_rating.py index f4ffb5a3c74..9cedb232b47 100644 --- a/addons/test_mail_full/tests/test_rating.py +++ b/addons/test_mail_full/tests/test_rating.py @@ -147,13 +147,13 @@ class TestRatingPerformance(TestRatingCommon): } for idx in range(RECORD_COUNT)]) self.flush_tracking() - with self.assertQueryCount(employee=2604): # tmf 2204 / com 2404 + with self.assertQueryCount(employee=2004): # tmf 2004 for record in record_ratings: access_token = record._rating_get_access_token() record.rating_apply(1, token=access_token) self.flush_tracking() - with self.assertQueryCount(employee=2603): # tmf 2203 / com 2403 + with self.assertQueryCount(employee=2003): # tmf 2003 for record in record_ratings: access_token = record._rating_get_access_token() record.rating_apply(5, token=access_token)