From 3d61afeb6001502f4c4dbff5d77f8c4b044a4e36 Mon Sep 17 00:00:00 2001 From: Leonardo Pavan Rocha Date: Wed, 4 Oct 2023 22:51:12 +0200 Subject: [PATCH] [IMP] test_discuss_full: prevent im_status being wrong when homeworking is installed Homeworking changes the im_status of a partner if the employee is at the office or not. So, im_status 'online' would become 'office_online' so that we can show different icons to highlight that a person is at the office or at home. Since the tests in test_discuss_full expect specifically 'online', it made the tests fail. If we make the assertion using the partner's im_status, it prevents the test from failing while keeping its value. task-3527196 Part-of: odoo/odoo#137502 --- .../tests/test_performance.py | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/addons/test_discuss_full/tests/test_performance.py b/addons/test_discuss_full/tests/test_performance.py index 87c244d8073..3a7afe43f51 100644 --- a/addons/test_discuss_full/tests/test_performance.py +++ b/addons/test_discuss_full/tests/test_performance.py @@ -12,7 +12,7 @@ from odoo.tools.misc import DEFAULT_SERVER_DATETIME_FORMAT @tagged('post_install', '-at_install') class TestDiscussFullPerformance(HttpCase): - _query_count = 72 + _query_count = 73 def setUp(self): super().setUp() @@ -147,7 +147,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'e.e@example.com', 'id': self.users[0].partner_id.id, - 'im_status': 'online', + 'im_status': self.users[0].partner_id.im_status, 'is_company': False, 'name': 'Ernest Employee', 'out_of_office_date_end': False, @@ -198,7 +198,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'e.e@example.com', 'id': self.users[0].partner_id.id, - 'im_status': 'online', + 'im_status': self.users[0].partner_id.im_status, 'is_company': False, 'name': 'Ernest Employee', 'out_of_office_date_end': False, @@ -249,7 +249,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'e.e@example.com', 'id': self.users[0].partner_id.id, - 'im_status': 'online', + 'im_status': self.users[0].partner_id.im_status, 'is_company': False, 'name': 'Ernest Employee', 'out_of_office_date_end': False, @@ -300,7 +300,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'e.e@example.com', 'id': self.users[0].partner_id.id, - 'im_status': 'online', + 'im_status': self.users[0].partner_id.im_status, 'is_company': False, 'name': 'Ernest Employee', 'out_of_office_date_end': False, @@ -351,7 +351,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'e.e@example.com', 'id': self.users[0].partner_id.id, - 'im_status': 'online', + 'im_status': self.users[0].partner_id.im_status, 'is_company': False, 'name': 'Ernest Employee', 'out_of_office_date_end': False, @@ -403,7 +403,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'e.e@example.com', 'id': self.users[0].partner_id.id, - 'im_status': 'online', + 'im_status': self.users[0].partner_id.im_status, 'is_company': False, 'name': 'Ernest Employee', 'out_of_office_date_end': False, @@ -423,7 +423,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': False, 'id': self.users[12].partner_id.id, - 'im_status': 'offline', + 'im_status': self.users[12].partner_id.im_status, 'is_company': False, 'name': 'test12', 'out_of_office_date_end': False, @@ -490,7 +490,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'e.e@example.com', 'id': self.users[0].partner_id.id, - 'im_status': 'online', + 'im_status': self.users[0].partner_id.im_status, 'is_company': False, 'name': 'Ernest Employee', 'out_of_office_date_end': False, @@ -510,7 +510,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': False, 'id': self.users[14].partner_id.id, - 'im_status': 'offline', + 'im_status': self.users[14].partner_id.im_status, 'is_company': False, 'name': 'test14', 'out_of_office_date_end': False, @@ -577,7 +577,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'e.e@example.com', 'id': self.users[0].partner_id.id, - 'im_status': 'online', + 'im_status': self.users[0].partner_id.im_status, 'is_company': False, 'name': 'Ernest Employee', 'out_of_office_date_end': False, @@ -597,7 +597,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': False, 'id': self.users[15].partner_id.id, - 'im_status': 'offline', + 'im_status': self.users[15].partner_id.im_status, 'is_company': False, 'name': 'test15', 'out_of_office_date_end': False, @@ -664,7 +664,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'e.e@example.com', 'id': self.users[0].partner_id.id, - 'im_status': 'online', + 'im_status': self.users[0].partner_id.im_status, 'is_company': False, 'name': 'Ernest Employee', 'out_of_office_date_end': False, @@ -684,7 +684,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'test2@example.com', 'id': self.users[2].partner_id.id, - 'im_status': 'offline', + 'im_status': self.users[2].partner_id.im_status, 'is_company': False, 'name': 'test2', 'out_of_office_date_end': False, @@ -751,7 +751,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'e.e@example.com', 'id': self.users[0].partner_id.id, - 'im_status': 'online', + 'im_status': self.users[0].partner_id.im_status, 'is_company': False, 'name': 'Ernest Employee', 'out_of_office_date_end': False, @@ -771,7 +771,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': False, 'id': self.users[3].partner_id.id, - 'im_status': 'offline', + 'im_status': self.users[3].partner_id.im_status, 'is_company': False, 'name': 'test3', 'out_of_office_date_end': False, @@ -941,7 +941,7 @@ class TestDiscussFullPerformance(HttpCase): 'id': self.channel_livechat_2.channel_member_ids.filtered(lambda m: m.guest_id).id, 'persona': { 'id': self.channel_livechat_2.channel_member_ids.filtered(lambda m: m.guest_id).guest_id.id, - 'im_status': 'offline', + 'im_status': self.channel_livechat_2.channel_member_ids.filtered(lambda m: m.guest_id).guest_id.im_status, 'name': self.channel_livechat_2.channel_member_ids.filtered(lambda m: m.guest_id).guest_id.name, 'type': "guest", }, @@ -1012,7 +1012,7 @@ class TestDiscussFullPerformance(HttpCase): 'active': True, 'email': 'e.e@example.com', 'id': self.users[0].partner_id.id, - 'im_status': 'online', + 'im_status': self.users[0].partner_id.im_status, 'is_company': False, 'name': 'Ernest Employee', 'out_of_office_date_end': False,