summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/helpers/test_utils_mock.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/tests/helpers/test_utils_mock.js')
-rw-r--r--addons/web/static/tests/helpers/test_utils_mock.js11
1 files changed, 5 insertions, 6 deletions
diff --git a/addons/web/static/tests/helpers/test_utils_mock.js b/addons/web/static/tests/helpers/test_utils_mock.js
index 962b9610f4b..8474ed22709 100644
--- a/addons/web/static/tests/helpers/test_utils_mock.js
+++ b/addons/web/static/tests/helpers/test_utils_mock.js
@@ -173,11 +173,12 @@ async function _getMockedOwlEnv(params, mockServer) {
function _mockGlobalObjects(params) {
// store initial session state (for restoration)
const initialSession = Object.assign({}, session);
- // patch session
- Object.assign(session, {
+ const sessionPatch = Object.assign({
getTZOffset() { return 0; },
async user_has_group() { return false; },
}, params.session);
+ // patch session
+ Object.assign(session, sessionPatch);
// patch config
let initialConfig;
@@ -202,10 +203,8 @@ function _mockGlobalObjects(params) {
// build the cleanUp function to restore everything at the end of the test
function cleanUp() {
let key;
- if ('session' in params) {
- for (key in session) {
- delete session[key];
- }
+ for (key in sessionPatch) {
+ delete session[key];
}
Object.assign(session, initialSession);
if ('config' in params) {