summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-11-17 15:34:13 +0100
committerAaron Bohy <aab@odoo.com>2017-11-23 11:00:53 +0100
commitbaae272ffdbb3b723ce9d2f09dfe720b8bbde27b (patch)
treec6d1e481a8be6e787b868b1d394344b65649b599 /addons/web/static/tests/views
parentb4609e3c254658b853f774abc5d244036770e2ac (diff)
[REF] web: tests: make load_views RPCs go through mockRPC
This allows to inspect those RPCs and the given arguments as well.
Diffstat (limited to 'addons/web/static/tests/views')
-rw-r--r--addons/web/static/tests/views/form_tests.js8
-rw-r--r--addons/web/static/tests/views/view_dialogs_tests.js9
2 files changed, 9 insertions, 8 deletions
diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/views/form_tests.js
index bf88a921b67..4067a2d4c39 100644
--- a/addons/web/static/tests/views/form_tests.js
+++ b/addons/web/static/tests/views/form_tests.js
@@ -4272,7 +4272,7 @@ QUnit.module('Views', {
});
QUnit.test('open one2many form containing one2many', function (assert) {
- assert.expect(8);
+ assert.expect(9);
this.data.partner.records[0].product_ids = [37];
this.data.product.fields.partner_type_ids = {
@@ -4326,7 +4326,7 @@ QUnit.module('Views', {
"the row should contains the 2 fields defined in the form view");
assert.strictEqual($(modal_row).text(), "gold2",
"the value of the fields should be fetched and displayed");
- assert.verifySteps(['read', 'read', 'read', 'read'],
+ assert.verifySteps(['read', 'read', 'load_views', 'read', 'read'],
"there should be 4 read rpcs");
form.destroy();
});
@@ -5905,7 +5905,7 @@ QUnit.module('Views', {
// parent view. If this event isn't stopPropagated by the first controller
// catching it, it will crash when the other one will try to handle it,
// as this one doesn't know at all the dataPointID to reload.
- assert.expect(9);
+ assert.expect(11);
var arch = '<form>' +
'<field name="display_name"/>' +
@@ -5943,8 +5943,10 @@ QUnit.module('Views', {
assert.verifySteps([
"read", // main record
"get_formview_id", // id of first form view opened in a dialog
+ "load_views", // arch of first form view opened in a dialog
"read", // first dialog
"get_formview_id", // id of second form view opened in a dialog
+ "load_views", // arch of second form view opened in a dialog
"read", // second dialog
"write", // save second dialog
"read", // reload first dialog
diff --git a/addons/web/static/tests/views/view_dialogs_tests.js b/addons/web/static/tests/views/view_dialogs_tests.js
index 1d99d5b1cb7..b2dc9c5ab0e 100644
--- a/addons/web/static/tests/views/view_dialogs_tests.js
+++ b/addons/web/static/tests/views/view_dialogs_tests.js
@@ -88,8 +88,7 @@ QUnit.module('Views', {
'</search>',
},
mockRPC: function (route, args) {
- search++;
- if (search === 1 && args.method === 'read_group') {
+ if (args.method === 'read_group') {
assert.deepEqual(args.kwargs, {
context: {group_by: "bar"},
domain: [["display_name","like","a"], ["display_name","ilike","piou"], ["foo","ilike","piou"]],
@@ -99,7 +98,8 @@ QUnit.module('Views', {
lazy: true
}, "should search with the complete domain (domain + search), and group by 'bar'");
}
- if (search === 2 && route === '/web/dataset/search_read') {
+ if (search === 0 && route === '/web/dataset/search_read') {
+ search++;
assert.deepEqual(args, {
context: {},
domain: [["display_name","like","a"], ["display_name","ilike","piou"], ["foo","ilike","piou"]],
@@ -108,8 +108,7 @@ QUnit.module('Views', {
limit: 80,
sort: ""
}, "should search with the complete domain (domain + search)");
- }
- if (search === 3 && route === '/web/dataset/search_read') {
+ } else if (search === 1 && route === '/web/dataset/search_read') {
assert.deepEqual(args, {
context: {},
domain: [["display_name","like","a"]],