-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[REF] hr_holidays: convert tests to hoot
This commit aims to convert QUnit tests which rely on mail/test_utils to hoot. Part of task-3818666 closes odoo#171035 X-original-commit: 06d2cdc Signed-off-by: Didier Debondt (did) <[email protected]>
- Loading branch information
Showing
11 changed files
with
68 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
addons/hr_holidays/static/tests/helpers/mock_server/models/res_partner.js
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
addons/hr_holidays/static/tests/helpers/model_definitions_setup.js
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
addons/hr_holidays/static/tests/hr_holidays_test_helpers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { mailModels } from "@mail/../tests/mail_test_helpers"; | ||
import { defineModels } from "@web/../tests/web_test_helpers"; | ||
import { ResPartner } from "./mock_server/mock_models/res_partner"; | ||
import { HrEmployee } from "./mock_server/mock_models/hr_employee"; | ||
|
||
export function defineHrHolidaysModels() { | ||
return defineModels(hrHolidaysModels); | ||
} | ||
|
||
export const hrHolidaysModels = { ...mailModels, ResPartner, HrEmployee }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions
5
addons/hr_holidays/static/tests/mock_server/mock_models/hr_employee.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { models } from "@web/../tests/web_test_helpers"; | ||
|
||
export class HrEmployee extends models.ServerModel { | ||
_name = "hr.employee"; | ||
} |
23 changes: 23 additions & 0 deletions
23
addons/hr_holidays/static/tests/mock_server/mock_models/res_partner.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { mailModels } from "@mail/../tests/mail_test_helpers"; | ||
import { fields } from "@web/../tests/web_test_helpers"; | ||
|
||
export class ResPartner extends mailModels.ResPartner { | ||
out_of_office_date_end = fields.Date(); | ||
|
||
/** | ||
* Overrides to add out of office to employees. | ||
* @override | ||
* @type {typeof mailModels.ResPartner["prototype"]["mail_partner_format"]} | ||
*/ | ||
mail_partner_format(ids) { | ||
const partnerFormats = super.mail_partner_format(...arguments); | ||
const partners = this._filter([["id", "in", ids]], { | ||
active_test: false, | ||
}); | ||
for (const partner of partners) { | ||
// Not a real field but ease the testing | ||
partnerFormats[partner.id].out_of_office_date_end = partner.out_of_office_date_end; | ||
} | ||
return partnerFormats; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 7 additions & 10 deletions
17
...lidays/static/tests/thread_patch_tests.js → ...olidays/static/tests/thread_patch.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters