[REF] test_discuss_full: replace method by static property

Storing the _query_count value at the class level makes it trivial
to extend by dependant modules.

closes odoo/odoo#136669

Related: odoo/enterprise#47931
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
This commit is contained in:
Killian Frappart
2023-09-28 01:51:33 +00:00
parent 6eaf6f23b4
commit 66be8524f6
@@ -12,6 +12,8 @@ from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
@tagged('post_install', '-at_install')
class TestDiscussFullPerformance(HttpCase):
_query_count = 59
def setUp(self):
super().setUp()
self.group_user = self.env.ref('base.group_user')
@@ -109,7 +111,7 @@ class TestDiscussFullPerformance(HttpCase):
self.maxDiff = None
self.env.flush_all()
self.env.invalidate_all()
with self.assertQueryCount(emp=self._get_query_count()):
with self.assertQueryCount(emp=self._query_count):
init_messaging = self.users[0].with_user(self.users[0])._init_messaging()
self.assertEqual(init_messaging, self._get_init_messaging_result())
@@ -1038,10 +1040,3 @@ class TestDiscussFullPerformance(HttpCase):
'volume_settings_ids': [('ADD', [])],
},
}
def _get_query_count(self):
"""
Returns the expected query count.
The point of having a separate getter is to allow it to be overriden.
"""
return 59