Files
odoo_source/addons/web/static/tests/helpers/session.js
T
Michael (mcm) 77e825cab2 [REF] web: replace odoo module by native one
This commit converts almost all odoo module by native module.
The goal is to deprecate odoo.define in favor of native module and then
simplify boot.js by removing the regexp that finds module dependencies.

task id: 3162300

closes odoo/odoo#117456

Signed-off-by: Géry Debongnie <ged@odoo.com>
2023-04-04 16:01:57 +02:00

25 lines
977 B
JavaScript

/** @odoo-module alias=web.SessionOverrideForTests **/
// Override the Session.session_reload function
// The wowl test infrastructure does set a correct odoo global value before each test
// while the session is built only once for all tests.
// So if a test does a session_reload, it will merge the odoo global of that test
// into the session, and will alter every subsequent test of the suite.
// Obviously, we don't want that, ever.
import { session as sessionInfo } from "@web/session";
const initialSessionInfo = Object.assign({}, sessionInfo);
import Session from "web.Session";
import { patch } from "@web/core/utils/patch";
patch(Session.prototype, "web.SessionTestPatch", {
async session_reload() {
for (const key in sessionInfo) {
delete sessionInfo[key];
}
for (const key in initialSessionInfo) {
sessionInfo[key] = initialSessionInfo[key];
}
return await this._super(...arguments);
},
});