[18.0][FIX] queue_job: Fix TestJson#909
Conversation
pedrobaeza
left a comment
There was a problem hiding this comment.
I don't think this is the proper fix, but to control the context in the tests for not having that one, but you may want to have all the context keys serialized for any usage of it.
|
@pedrobaeza How can this be done, by modifying the |
|
Seeing the module, I think the final test line should be changed from: self.assertEqual(json.loads(value_json), expected)to: result_dict = json.loads(value_json)
for key in result_dict:
self.assertEqual(result_dict[key], expected[key]) |
|
You could compare the jsons without the context and then loop through it as @pedrobaeza suggested |
5038084 to
d08d9b7
Compare
christian-ramos-tecnativa
left a comment
There was a problem hiding this comment.
I think is not fully solved as we should loop just for the context key
christian-ramos-tecnativa
left a comment
There was a problem hiding this comment.
I was able to solve it with this changes
In this case, when a module adds a value in context, the tests fail
d08d9b7 to
27af421
Compare
pedrobaeza
left a comment
There was a problem hiding this comment.
OK, let's make it resilient this way.
/ocabot merge patch
|
This PR looks fantastic, let's merge it! |
|
Congratulations, your PR was merged at 1ea2c45. Thanks a lot for contributing to OCA. ❤️ |
When a module adds a value in context, the tests fail.
For example:
In this example, the
partner_external_mapmodule addedmap_website_id,route_map_website_id, androute_start_partner_idto the context, which caused the tests ofqueue_jobto fail.This fix ensures that only the keys returned by _job_prepare_context_before_enqueue_keys are preserved in the context, removing any additional values.
@pedrobaeza @christian-ramos-tecnativa could you review this PR?