diff options
| author | Aaron Bohy <aab@odoo.com> | 2020-06-05 09:18:14 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-06-12 09:47:48 +0000 |
| commit | b4ba0fc34082deec8ca6c871ce7a203c0a3a61a4 (patch) | |
| tree | 27451423f32b218e699d3135c398d338b249c5cd /addons/web/static/tests/control_panel | |
| parent | dc260c324170a90fa737cd21dd528e39d658d9b6 (diff) | |
[FIX] *: adapt tests to env rework
This commit adapts tests following recent changes on the helpers.
The main change is that addMockEnvironment (and all functions using
it) are now async, as they need to wait for services to be started.
Diffstat (limited to 'addons/web/static/tests/control_panel')
| -rw-r--r-- | addons/web/static/tests/control_panel/custom_filter_item_tests.js | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/addons/web/static/tests/control_panel/custom_filter_item_tests.js b/addons/web/static/tests/control_panel/custom_filter_item_tests.js index 52a5aa738a6..7602f56aae0 100644 --- a/addons/web/static/tests/control_panel/custom_filter_item_tests.js +++ b/addons/web/static/tests/control_panel/custom_filter_item_tests.js @@ -6,21 +6,10 @@ odoo.define('web.filter_menu_generator_tests', function (require) { const { Model } = require('web.model'); const pyUtils = require('web.py_utils'); const testUtils = require('web.test_utils'); - const session = require('web.session'); const cpHelpers = testUtils.controlPanel; const { createComponent } = testUtils; - function patchSession(newSession) { - // We have to patch the "legacy" session because field_utils is using it. - // TODO: remove it when the field_utils are re-written. - const initialSession = session; - Object.assign(session, newSession); - return function () { - Object.assign(session, initialSession); - }; - } - QUnit.module('Components', { beforeEach: function () { this.fields = { @@ -203,11 +192,6 @@ odoo.define('web.filter_menu_generator_tests', function (require) { QUnit.test('custom filter datetime with equal operator', async function (assert) { assert.expect(4); - patchSession({ - getTZOffset: function () { - return -240; - }, - }); class MockedControlPanelModel extends Model { createNewFilters(preFilters) { const preFilter = preFilters[0]; @@ -224,6 +208,11 @@ odoo.define('web.filter_menu_generator_tests', function (require) { props: { fields: this.fields, }, + session: { + getTZOffset() { + return -240; + }, + }, env: { controlPanelModel }, }); @@ -243,11 +232,6 @@ odoo.define('web.filter_menu_generator_tests', function (require) { QUnit.test('custom filter datetime between operator', async function (assert) { assert.expect(4); - patchSession({ - getTZOffset: function () { - return -240; - }, - }); class MockedControlPanelModel extends Model { createNewFilters(preFilters) { const preFilter = preFilters[0]; @@ -265,6 +249,11 @@ odoo.define('web.filter_menu_generator_tests', function (require) { props: { fields: this.fields, }, + session: { + getTZOffset() { + return -240; + }, + }, env: { controlPanelModel }, }); |
