[FIX] web: tests: fix issues in mock_model and mock_server #159348
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit fixes two issues.
The first one was in the mocked Model, in _unityReadRecords. When reading reference fields, we must read a related record, whose model and id are encoding in the value of the reference fields. Before this commit, we read the record on the wrong model (the main one, not the one of the reference field).
The second issue was in the MockServer. Commit [1] recently introduced the function stepAllNetworkCalls to call expect.step() for each server method/route called during the test. However, this didn't work properly for the route /web/dataset/call_kw/. First because of a small mistake ("===" instead of "startswith" to match the route). Second because we didn't call the regular mock function for those routes, leading to crashes as the server always returned undefined.
[1] e721f1c
Description of the issue/feature this PR addresses:
Current behavior before PR:
Desired behavior after PR is merged:
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr