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

[17.0][MIG] test_connector: Migration to 17.0 #478

Closed

Conversation

nguyenminhchien
Copy link

guewen and others added 30 commits November 27, 2023 10:30
So we can write tests using real pieces of the framework on real models
instead of using mocks which is quite limited and wring things in
confusing ways.

* Fix the related action implementation
* Move the tests of the Default Binding in this module so we have tests
  that reflect the reality
We probably want to use the same env that we have in the backend_record!
Besides, having 2 environments bring issues when we modify one but not
the other one.
The inheritance system is copied from the Odoo on, because it works well
for extending addons and because it will be easier to use for developers
accustomed to it.
Tests using odoo transactions must run post install, because during the
install the registry is not ready, so the components aren't neither.
It allows to open/close objects on start/end of a synchro / work
session. The base method does none of that, but this is a really common
use case. Example: at the beginning of the work session, I open a
webservice client that is available in our WorkContext for the duration
of our work. At the end, I close the client to end the connection.
When we want to test the implementation of a connector, it must be
simple. Add 2 new test cases for TransactionCase and SavepointCase which
load all the components of the dependencies addons on the tested addons.
Only the components of the addons in state 'installed' are loaded, so we
don't load components of addons that depend on the tested addon.

The tests must call _init_global_registry and build_registry instead of
_register_hook, so the registry is not set to ready. If the global
registry is set to ready during tests, the event will trigger during the
installation of addons which is not what we want.

The existing test case is meant only to be used when one has to
manipulate components in a custom registry.

See discussion on
guewen@447b22f#commitcomment-22851711
removes unknown fields from backend creation args
@nguyenminhchien nguyenminhchien marked this pull request as ready for review November 27, 2023 05:18
@nguyenminhchien nguyenminhchien mentioned this pull request Nov 27, 2023
6 tasks
@simahawk
Copy link
Contributor

/ocabot migration test_connector

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Nov 27, 2023
@simahawk
Copy link
Contributor

@nguyenminhchien the migration of test* modules make little sense out of the PR where you migrate the module. There's no way to understand if the module being migrated is failing or not until you look at all the others PRs and re-trigger their jobs.

@nguyenminhchien
Copy link
Author

@nguyenminhchien the migration of test* modules make little sense out of the PR where you migrate the module. There's no way to understand if the module being migrated is failing or not until you look at all the others PRs and re-trigger their jobs.

ok, i will merge this one with #476

@nguyenminhchien
Copy link
Author

Merged the migration of test_connector into #476

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.