From 66be8524f6ff0a8f5b923f59c46a2aeacec528df Mon Sep 17 00:00:00 2001 From: Killian Frappart Date: Tue, 26 Sep 2023 14:32:03 +0200 Subject: [PATCH] [REF] test_discuss_full: replace method by static property MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- addons/test_discuss_full/tests/test_performance.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/addons/test_discuss_full/tests/test_performance.py b/addons/test_discuss_full/tests/test_performance.py index 22f144834f6..7bda738d64e 100644 --- a/addons/test_discuss_full/tests/test_performance.py +++ b/addons/test_discuss_full/tests/test_performance.py @@ -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