diff options
| author | David Monjoie <dmo@odoo.com> | 2017-06-14 14:35:38 +0200 |
|---|---|---|
| committer | David Monjoie <dmo@odoo.com> | 2017-06-19 07:56:42 +0200 |
| commit | b8c1571d948e593779b83ba78130c341f1e427cd (patch) | |
| tree | 1e4370dd8f4647eedc8b614e50fcfb51d2cf7902 /addons/web/static/tests/views/basic_model_tests.js | |
| parent | 584c60f1ba7627230f0db445d167332344f83bfb (diff) | |
[FIX] web: prevent crash when giving wrong id in url
The mock server had to be modified in order to test this behavior
since it used to throw an error for invalid ids, while the actual
server just ignores it and continues forth with the other ids.
Diffstat (limited to 'addons/web/static/tests/views/basic_model_tests.js')
| -rw-r--r-- | addons/web/static/tests/views/basic_model_tests.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/addons/web/static/tests/views/basic_model_tests.js b/addons/web/static/tests/views/basic_model_tests.js index ca2f6f37f3e..cbe04f5b43b 100644 --- a/addons/web/static/tests/views/basic_model_tests.js +++ b/addons/web/static/tests/views/basic_model_tests.js @@ -92,6 +92,23 @@ QUnit.module('Views', { model.destroy(); }); + QUnit.test('rejects loading a record with invalid id', function (assert) { + assert.expect(1); + + this.params.res_id = 99; + + var model = createModel({ + Model: BasicModel, + data: this.data, + }); + + model.load(this.params).always(function (error) { + assert.strictEqual(this.state(), 'rejected', + "load should return a rejected deferred for an invalid id") + }); + model.destroy(); + }); + QUnit.test('notify change with many2one', function (assert) { assert.expect(2); |
