[FIX] hr_holidays: make ooo tests less dependent on channel_info members ordering
Purpose of this test is to avoid failing tests due to list ordering not
being always predictable in channel_info.
Some out of office tests are dependent on channel_info ordering. Indeed one
test relies on members list ordering (using [0] and [1]) instead of fetching
the right member in the given result list. In this commit we
* ensure members in channel_info effectively match expected members;
* check content of the right channel info member instead of relying on
list order;
LINKS
Task ID-2070632 (main task)
Task ID-2419762 (followup task)
COM PR odoo/odoo#62859
ENT PR odoo/enterprise#15172
UPG PR odoo/upgrade#2005
This commit is contained in:
@@ -52,8 +52,11 @@ class TestOutOfOffice(TestHrHolidaysCommon):
|
||||
'name': 'test'
|
||||
})
|
||||
channel_info = channel.channel_info()[0]
|
||||
self.assertFalse(channel_info['members'][0]['out_of_office_date_end'], "current user should not be out of office")
|
||||
self.assertEqual(channel_info['members'][1]['out_of_office_date_end'], leave_date_end, "correspondent should be out of office")
|
||||
self.assertEqual(len(channel_info['members']), 2, "Channel info should get info for the 2 members")
|
||||
partner_info = next(c for c in channel_info['members'] if c['email'] == partner.email)
|
||||
partner2_info = next(c for c in channel_info['members'] if c['email'] == partner2.email)
|
||||
self.assertFalse(partner2_info['out_of_office_date_end'], "current user should not be out of office")
|
||||
self.assertEqual(partner_info['out_of_office_date_end'], leave_date_end, "correspondent should be out of office")
|
||||
|
||||
|
||||
@tagged('out_of_office')
|
||||
|
||||
Reference in New Issue
Block a user