summaryrefslogtreecommitdiff
path: root/addons/test_mail/tests/test_performance.py
diff options
context:
space:
mode:
authorThibault Delavallée <tde@odoo.com>2018-05-04 11:55:41 +0200
committerThibault Delavallée <tde@odoo.com>2018-08-07 15:42:50 +0200
commitdf8130b2fa3a829f798e3aef648f75b5cd90f1f6 (patch)
treec86ccfe36bbd70c3bbc5d8cf63a65b754372040c /addons/test_mail/tests/test_performance.py
parent6de76cc4f1a44462ae2d600887078d70df73520a (diff)
[REF] test_mail: update counters due to enterprise mail_push update
This commit is related to enterprise commit that updated mail_push. It is about [REF] mail_push: optimize mail.message notification process override It updates code of mail_push to lessen its impact on mail-related code. It allows to change a few counters in test_mail. Indeed counters are impacted by code located in enterprise because those are "maximum queries" counters. As mail_push is an auto-install module enterprise runbot would be broken if the counters weren't updated. This commit is linked to task ID 47934 and PR #24033. No functional change should occur with this commit.
Diffstat (limited to 'addons/test_mail/tests/test_performance.py')
-rw-r--r--addons/test_mail/tests/test_performance.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/addons/test_mail/tests/test_performance.py b/addons/test_mail/tests/test_performance.py
index 38fcba3be8f..43ecaa3f236 100644
--- a/addons/test_mail/tests/test_performance.py
+++ b/addons/test_mail/tests/test_performance.py
@@ -173,7 +173,7 @@ class TestAdvMailPerformance(TransactionCase):
'activity_type_id': self.env.ref('mail.mail_activity_data_todo').id,
})
- with self.assertQueryCount(margin=1, admin=27, emp=48): # com runbot: 27 - 47 // test_mail only: 27 - 48
+ with self.assertQueryCount(margin=1, admin=27, emp=47): # test_mail only: 27 - 47
activity.action_feedback(feedback='Zizisse Done !')
@users('admin', 'emp')
@@ -187,7 +187,7 @@ class TestAdvMailPerformance(TransactionCase):
record.write({'name': 'Dupe write'})
- with self.assertQueryCount(margin=1, admin=29, emp=50): # com runbot: 27 - 49 // test_mail only: 29 - 50
+ with self.assertQueryCount(margin=1, admin=29, emp=49): # test_mail only: 29 - 49
record.action_close('Dupe feedback')
self.assertEqual(record.activity_ids, self.env['mail.activity'])
@@ -199,7 +199,7 @@ class TestAdvMailPerformance(TransactionCase):
self.user_test.write({'notification_type': 'email'})
record = self.env['mail.test.track'].create({'name': 'Test'})
- with self.assertQueryCount(margin=1, admin=60, emp=78): # com runbot: 59 - 77 // test_mail only: 60 - 78
+ with self.assertQueryCount(margin=1, admin=59, emp=77): # com runbot: 59 - 77 // test_mail only: 59 - 77
record.write({
'user_id': self.user_test.id,
})
@@ -229,7 +229,7 @@ class TestAdvMailPerformance(TransactionCase):
def test_message_log_with_post(self):
record = self.env['mail.test.simple'].create({'name': 'Test'})
- with self.assertQueryCount(admin=11, emp=18): # com runbot: 7 - 13 // test_mail only: 11 - 18
+ with self.assertQueryCount(admin=7, emp=13): # test_mail only: 7 - 13
record.message_post(
body='<p>Test message_post as log</p>',
subtype='mail.mt_note',
@@ -240,7 +240,7 @@ class TestAdvMailPerformance(TransactionCase):
def test_message_post_no_notification(self):
record = self.env['mail.test.simple'].create({'name': 'Test'})
- with self.assertQueryCount(admin=11, emp=18): # com runbot: 7 - 13 // test_mail only: 11 - 18
+ with self.assertQueryCount(admin=7, emp=13): # test_mail only: 7 - 13
record.message_post(
body='<p>Test Post Performances basic</p>',
partner_ids=[],
@@ -253,7 +253,7 @@ class TestAdvMailPerformance(TransactionCase):
def test_message_post_one_email_notification(self):
record = self.env['mail.test.simple'].create({'name': 'Test'})
- with self.assertQueryCount(margin=1, admin=55, emp=74): # com runbot: 48 - 67 // test_mail only: 55 - 74
+ with self.assertQueryCount(margin=1, admin=50, emp=69): # com runbot: 48 - 67 // test_mail only: 50 - 69
record.message_post(
body='<p>Test Post Performances with an email ping</p>',
partner_ids=self.customer.ids,
@@ -265,7 +265,7 @@ class TestAdvMailPerformance(TransactionCase):
def test_message_post_one_inbox_notification(self):
record = self.env['mail.test.simple'].create({'name': 'Test'})
- with self.assertQueryCount(margin=1, admin=32, emp=45): # com runbot 30 - 41 // test_mail only: 32 - 45
+ with self.assertQueryCount(margin=1, admin=31, emp=42): # com runbot 30 - 41 // test_mail only: 31 - 42
record.message_post(
body='<p>Test Post Performances with an inbox ping</p>',
partner_ids=self.user_test.partner_id.ids,
@@ -389,7 +389,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=90, emp=112): # com runbot 83 - 105 // test_mail only: 90 - 112
+ with self.assertQueryCount(admin=85, emp=107): # com runbot 83 - 105 // test_mail only: 85 - 107
record.message_post(
body='<p>Test Post Performances</p>',
message_type='comment',
@@ -406,7 +406,7 @@ class TestHeavyMailPerformance(TransactionCase):
record = self.umbrella.sudo(self.env.user)
template_id = self.env.ref('test_mail.mail_test_tpl').id
- with self.assertQueryCount(admin=109, emp=143): # com runbot 102 - 136 // test_mail only: 109 - 143
+ with self.assertQueryCount(admin=104, emp=138): # com runbot 102 - 136 // test_mail only: 104 - 138
record.message_post_with_template(template_id, message_type='comment', composition_mode='comment')
self.assertEqual(record.message_ids[0].body, '<p>Adding stuff on %s</p>' % record.name)
@@ -476,7 +476,7 @@ class TestHeavyMailPerformance(TransactionCase):
})
self.assertEqual(rec.message_partner_ids, self.partners | self.env.user.partner_id)
- with self.assertQueryCount(admin=62, emp=80): # com runbot: 61 - 79 // test_mail only: 62 - 80
+ with self.assertQueryCount(admin=61, emp=79): # com runbot: 61 - 79 // test_mail only: 61 - 79
rec.write({'user_id': self.user_portal.id})
self.assertEqual(rec.message_partner_ids, self.partners | self.env.user.partner_id | self.user_portal.partner_id)
@@ -499,7 +499,7 @@ class TestHeavyMailPerformance(TransactionCase):
customer_id = self.customer.id
user_id = self.user_portal.id
- with self.assertQueryCount(margin=1, admin=165, emp=200): # com runbot: 163 - 198 // test_mail only: 165 - 200
+ with self.assertQueryCount(margin=1, admin=163, emp=198): # com runbot: 163 - 198 // test_mail only: 163 - 198
rec = self.env['mail.test.full'].create({
'name': 'Test',
'umbrella_id': umbrella_id,
@@ -528,7 +528,7 @@ class TestHeavyMailPerformance(TransactionCase):
})
self.assertEqual(rec.message_partner_ids, self.user_portal.partner_id | self.env.user.partner_id)
- with self.assertQueryCount(margin=1, admin=100, emp=118): # com runbot: 99 - 117 // test_mail only: 100 - 118
+ with self.assertQueryCount(margin=1, admin=99, emp=117): # com runbot: 99 - 117 // test_mail only: 99 - 117
rec.write({
'name': 'Test2',
'umbrella_id': self.umbrella.id,