Files
odoo_source/addons/website/static/tests/website_service_mock.js
T
Younn Olivier 95c8f1a6a8 [FIX] website: fix restricted_editor test
See merge commit for more information.

task-2687506
2022-06-24 10:28:07 +02:00

36 lines
1012 B
JavaScript

/** @odoo-module */
import { patch } from '@web/core/utils/patch';
import { registry } from '@web/core/registry';
import { utils, clearRegistryWithCleanup } from '@web/../tests/helpers/mock_env';
const { prepareRegistriesWithCleanup } = utils;
function makeFakeWebsiteService() {
return {
start() {
return {
get context() {
return {};
},
get isPublisher() {
return true;
},
get hasMultiWebsites() {
return true;
},
async fetchUserGroups() {},
};
}
};
}
const serviceRegistry = registry.category('services');
patch(utils, 'website_test_registries', {
prepareRegistriesWithCleanup() {
prepareRegistriesWithCleanup(...arguments);
serviceRegistry.add('website', makeFakeWebsiteService());
clearRegistryWithCleanup(registry.category('website_systray'));
},
});