Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] web: tests: fix issues in mock_model and mock_server #159348

Closed
wants to merge 1 commit into from

Conversation

aab-odoo
Copy link
Contributor

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

@robodoo
Copy link
Contributor

robodoo commented Mar 26, 2024

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 encoded 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 routes /web/dataset/call_kw/<path>.
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
@C3POdoo C3POdoo added the RD research & development, internal work label Mar 26, 2024
@aab-odoo
Copy link
Contributor Author

Fixed by #159826

@aab-odoo aab-odoo closed this Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RD research & development, internal work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants